diff options
author | Hans Goudey <h.goudey@me.com> | 2021-09-27 21:04:58 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-09-27 21:04:58 +0300 |
commit | 5d70a4d7ee4e31de7784acc9dc0637e39c949583 (patch) | |
tree | 51d948e39d8f1bd72723772c1f63c2547f50c957 /source | |
parent | e6aabcae143299893aeacc00ec0c865fc72e9dcf (diff) |
Geometry Nodes: Move output attribute names to a subpanel
In a sub-panel it will be clearer that they are outputs, since they
just look like more inputs now. Unfortunately it is not possible to
make sub-panels display conditionally currently, so the output
sub-panel will always be visible whether or not it is empty.
Differential Revision: https://developer.blender.org/D12653
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/modifiers/intern/MOD_nodes.cc | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index c39beb63eb3..6e930e391d0 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -1205,11 +1205,6 @@ static void panel_draw(const bContext *C, Panel *panel) LISTBASE_FOREACH (bNodeSocket *, socket, &nmd->node_group->inputs) { draw_property_for_input_socket(layout, nmd, &bmain_ptr, ptr, *socket); } - LISTBASE_FOREACH (bNodeSocket *, socket, &nmd->node_group->outputs) { - if (socket_type_has_attribute_toggle(*socket)) { - draw_property_for_output_socket(layout, ptr, *socket); - } - } } /* Draw node warnings. */ @@ -1239,9 +1234,34 @@ static void panel_draw(const bContext *C, Panel *panel) modifier_panel_end(layout, ptr); } +static void output_attribute_panel_draw(const bContext *UNUSED(C), Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr); + NodesModifierData *nmd = static_cast<NodesModifierData *>(ptr->data); + + uiLayoutSetPropSep(layout, true); + uiLayoutSetPropDecorate(layout, true); + + if (nmd->node_group != nullptr && nmd->settings.properties != nullptr) { + LISTBASE_FOREACH (bNodeSocket *, socket, &nmd->node_group->outputs) { + if (socket_type_has_attribute_toggle(*socket)) { + draw_property_for_output_socket(layout, ptr, *socket); + } + } + } +} + static void panelRegister(ARegionType *region_type) { - modifier_panel_register(region_type, eModifierType_Nodes, panel_draw); + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Nodes, panel_draw); + modifier_subpanel_register(region_type, + "output_attributes", + N_("Output Attributes"), + nullptr, + output_attribute_panel_draw, + panel_type); } static void blendWrite(BlendWriter *writer, const ModifierData *md) |