diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-08-14 21:56:33 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-08-14 21:56:33 +0400 |
commit | e83ef85576a04c41b719176f7797596fe9866a2c (patch) | |
tree | 460f2db930a31524e1678b423f7937e740caa0d9 /source/blender/makesrna | |
parent | 3220ef9d952b71c397849ea64abb882ea65b4d48 (diff) |
Python node operator for combined node collapsing and hiding unused sockets. Socket hide flag is added to RNA as well, but can only be set when the socket is not connected, to avoid dangling links in editor drawing. Currently this operator has no default hotkey, but can be called from the Node menu.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 9e4d29eca52..27201ea6389 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -324,6 +324,20 @@ static char *rna_NodeSocket_path(PointerRNA *ptr) return NULL; } +static void rna_NodeSocket_hide_set(PointerRNA *ptr, int value) +{ + bNodeSocket *sock = (bNodeSocket *)ptr->data; + + /* don't hide linked sockets */ + if (sock->flag & SOCK_IN_USE) + return; + + if (value) + sock->flag |= SOCK_HIDDEN; + else + sock->flag &= ~SOCK_HIDDEN; +} + /* Button Set Funcs for Matte Nodes */ static void rna_Matte_t1_set(PointerRNA *ptr, float value) { @@ -4106,6 +4120,17 @@ static void rna_def_node_socket(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Group Socket", "For group nodes, the group input or output socket this corresponds to"); + prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_HIDDEN); + RNA_def_property_boolean_funcs(prop, NULL, "rna_NodeSocket_hide_set"); + RNA_def_property_ui_text(prop, "Hide", "Hide the socket"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL); + + prop = RNA_def_property(srna, "is_linked", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_IN_USE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Linked", "True if the socket is connected"); + prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SOCK_COLLAPSED); RNA_def_property_ui_text(prop, "Expanded", "Socket links are expanded in the user interface"); |