ShaderNodes
Bases: Tree
Source code in core/shadernodes.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
__init__(tree_name, *, fake_user=False, is_group=False, prefix=None, replace_material=False, color_tag='NONE')
ShaderNodes
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree_name
|
str
|
Shader Nodes name |
required |
fake_user
|
bool
|
set fake_user flag default=False. |
False
|
is_group
|
bool
|
tree is a group default=False. |
False
|
prefix
|
str
|
name prefix default=None. |
None
|
replace_material
|
bool
|
replace material if already exists default=False. |
False
|
color_tag
|
str
|
group or modifier color_tag attribute (groups only) |
'NONE'
|
Source code in core/shadernodes.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
add_method(target_class, func_name=None, self_attr=None, ret_class=None, **fixed)
Add a method calling the Group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_class
|
type
|
class to add the method to |
required |
func_name
|
str
|
name of the method to create (snae case version of group name if None) default=None. |
None
|
self_attr
|
str
|
self name attribute name default=None. |
None
|
ret_class
|
type
|
class to use to transtype the output socket default=None. |
None
|
fixed
|
dict
|
fixed values for sockets |
{}
|
Source code in core/treeclass.py
1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 | |
arrange()
Arrange the nodes in the editor.
Try to arrange properly the nodes from left to right.
This method is called when the Tree is poped from the stack.
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in core/treeclass.py
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | |
clear(keep_nodes=True)
Clear the content of the Tree.
Remove all the nodes in the Tree.
Source code in core/treeclass.py
920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | |
create_input_socket(bl_idname, name, panel='', **props)
Create a new input socket.
This is an input socket of the zone, hence an output socket of the input node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bl_idname
|
str
|
Socket bl_idname |
required |
name
|
str
|
Socket name |
required |
panel
|
str
|
Panel to place the socket in |
''
|
**props
|
dict
|
Properties specific to interface socket |
{}
|
Returns:
| Type | Description |
|---|---|
Socket
|
|
Source code in core/treeclass.py
1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | |
current_tree()
staticmethod
Get the Current Tree.
Returns None if no tree is currently open
Returns:
| Type | Description |
|---|---|
Tree
|
current tree or None |
Source code in core/treeclass.py
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | |
get_output_node(target='ALL')
Output node
Standard behavior if Group or within a zone
Source code in core/shadernodes.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
get_signature(include=None, exclude=[], enabled_only=True, with_sockets=False)
Build the closure signature of the tree.
The closure signature is the tuple made of the output signature of the input node and the input signature of the output node
Returns:
| Type | Description |
|---|---|
Signature
|
|
Source code in core/treeclass.py
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | |
is_geonodes()
classmethod
Current Tree is Geometry Nodes.
Returns:
| Type | Description |
|---|---|
True if Tree is GeoNodes, False otherwise
|
|
Source code in core/treeclass.py
874 875 876 877 878 879 880 881 882 | |
is_shader()
classmethod
Current Tree is Shader Nodes.
Returns:
| Type | Description |
|---|---|
True if Tree is ShaderNodes, False otherwise
|
|
Source code in core/treeclass.py
884 885 886 887 888 889 890 891 892 | |
link(out_socket, in_socket, handle_dynamic_sockets=False)
Create a link between two sockets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out_socket
|
socket
|
a node output socket |
required |
in_socket
|
socket
|
input socket from another node |
required |
Returns:
| Type | Description |
|---|---|
Link
|
|
Source code in core/treeclass.py
1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | |
pop(error=False)
Remove this tree from the stack
Important
This methods shouldn't be called directly, better use a with context block.
Raises:
| Type | Description |
|---|---|
NodeError
|
if this tree is not the current one |
``` python
|
|
with Tree("My Name"):
|
pass |
```
|
|
Source code in core/treeclass.py
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | |
push()
Make this tree zone the current one
Important
This methods shouldn't be called directly, better use a with context block.
with Tree("My Name"):
pass
Source code in core/treeclass.py
582 583 584 585 586 587 588 589 590 591 592 593 594 | |
register_node(node)
Register a new Node.
This method is called by the Node class constructor. Never call directly.
Registered Nodes are stored in the dictionary : _nodes = bpy.types.Node.name -> Node
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node
|
Node
|
the newly created Node to register |
required |
Returns:
| Type | Description |
|---|---|
Node
|
the passed argument |
Source code in core/treeclass.py
950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | |
remove_groups(names=None, prefix=None, geonodes=True, shadernodes=True)
staticmethod
Remove Groups created by GeoNodes.
Important
This method can only remove groups created by GeoNodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
names
|
str or list of strs
|
name of the node groups to remove (all if None) |
None
|
prefix
|
str
|
name prefix for the groups to delete |
None
|
geonodes
|
bool
|
remove geometry nodes groups |
True
|
shadernodes
|
bool
|
remove shader nodes groups |
True
|
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in core/treeclass.py
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | |