nodebpy 0.6.0__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nodebpy-0.6.0 → nodebpy-0.7.0}/PKG-INFO +1 -1
- {nodebpy-0.6.0 → nodebpy-0.7.0}/pyproject.toml +1 -1
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/builder.py +49 -7
- {nodebpy-0.6.0 → nodebpy-0.7.0}/README.md +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/__init__.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/arrange.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/lib/nodearrange/__init__.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/lib/nodearrange/arrange/graph.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/lib/nodearrange/arrange/ordering.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/lib/nodearrange/arrange/ranking.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/lib/nodearrange/arrange/realize.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/lib/nodearrange/arrange/stacking.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/lib/nodearrange/arrange/structs.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/lib/nodearrange/arrange/sugiyama.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/lib/nodearrange/arrange/x_coords.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/lib/nodearrange/arrange/y_coords.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/lib/nodearrange/config.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/lib/nodearrange/utils.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/__init__.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/__init__.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/color.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/converter.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/distort.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/filter.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/group.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/input.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/interface.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/manual.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/matte.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/output.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/texture.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/compositor/vector.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/__init__.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/attribute.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/color.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/converter.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/geometry.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/grid.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/group.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/input.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/interface.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/manual.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/output.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/texture.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/vector.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/geometry/zone.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/__init__.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/color.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/converter.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/grid.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/group.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/input.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/interface.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/manual.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/output.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/script.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/shader.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/texture.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/vector.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/nodes/shader/zone.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/screenshot.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/sockets.py +0 -0
- {nodebpy-0.6.0 → nodebpy-0.7.0}/src/nodebpy/types.py +0 -0
|
@@ -61,12 +61,39 @@ class SocketError(Exception):
|
|
|
61
61
|
"""Raised when a socket operation fails."""
|
|
62
62
|
|
|
63
63
|
|
|
64
|
+
class PanelContext:
|
|
65
|
+
"""Context manager for grouping sockets into a panel."""
|
|
66
|
+
|
|
67
|
+
def __init__(
|
|
68
|
+
self,
|
|
69
|
+
socket_context: SocketContext,
|
|
70
|
+
name: str,
|
|
71
|
+
*,
|
|
72
|
+
default_closed: bool = False,
|
|
73
|
+
):
|
|
74
|
+
self._socket_context = socket_context
|
|
75
|
+
self._name = name
|
|
76
|
+
self._default_closed = default_closed
|
|
77
|
+
self._panel: bpy.types.NodeTreeInterfacePanel | None = None
|
|
78
|
+
|
|
79
|
+
def __enter__(self):
|
|
80
|
+
self._panel = self._socket_context.interface.new_panel(
|
|
81
|
+
self._name, default_closed=self._default_closed
|
|
82
|
+
)
|
|
83
|
+
self._socket_context._active_panel = self._panel
|
|
84
|
+
return self
|
|
85
|
+
|
|
86
|
+
def __exit__(self, *args):
|
|
87
|
+
self._socket_context._active_panel = None
|
|
88
|
+
|
|
89
|
+
|
|
64
90
|
class SocketContext:
|
|
65
91
|
_direction: Literal["INPUT", "OUTPUT"] | None
|
|
66
92
|
_active_context: SocketContext | None = None
|
|
67
93
|
|
|
68
94
|
def __init__(self, tree_builder: TreeBuilder):
|
|
69
95
|
self.builder = tree_builder
|
|
96
|
+
self._active_panel: bpy.types.NodeTreeInterfacePanel | None = None
|
|
70
97
|
|
|
71
98
|
@property
|
|
72
99
|
def tree(self) -> NodeTree:
|
|
@@ -80,15 +107,22 @@ class SocketContext:
|
|
|
80
107
|
assert interface is not None
|
|
81
108
|
return interface
|
|
82
109
|
|
|
110
|
+
def panel(self, name: str, *, default_closed: bool = False) -> PanelContext:
|
|
111
|
+
"""Create a panel context for grouping sockets."""
|
|
112
|
+
return PanelContext(self, name, default_closed=default_closed)
|
|
113
|
+
|
|
83
114
|
def _create_socket(
|
|
84
115
|
self, socket_def: SocketBase, name: str
|
|
85
116
|
) -> bpy.types.NodeTreeInterfaceSocket:
|
|
86
117
|
"""Create a socket from a socket definition."""
|
|
87
|
-
|
|
88
|
-
name
|
|
89
|
-
in_out
|
|
90
|
-
socket_type
|
|
91
|
-
|
|
118
|
+
kwargs: dict[str, Any] = {
|
|
119
|
+
"name": name,
|
|
120
|
+
"in_out": self._direction,
|
|
121
|
+
"socket_type": socket_def._bl_socket_type,
|
|
122
|
+
}
|
|
123
|
+
if self._active_panel is not None:
|
|
124
|
+
kwargs["parent"] = self._active_panel
|
|
125
|
+
socket = self.interface.new_socket(**kwargs)
|
|
92
126
|
socket.description = socket_def.description
|
|
93
127
|
return socket
|
|
94
128
|
|
|
@@ -100,7 +134,6 @@ class SocketContext:
|
|
|
100
134
|
def __exit__(self, *args):
|
|
101
135
|
SocketContext._direction = None
|
|
102
136
|
SocketContext._active_context = None
|
|
103
|
-
pass
|
|
104
137
|
|
|
105
138
|
|
|
106
139
|
class DirectionalContext(SocketContext):
|
|
@@ -662,7 +695,14 @@ class NodeBuilder:
|
|
|
662
695
|
else: # Both operands are scalar types, use regular Math
|
|
663
696
|
from .nodes.geometry.converter import IntegerMath, Math
|
|
664
697
|
|
|
665
|
-
|
|
698
|
+
# only the Geometry Node Tree supports integer math currently, potential
|
|
699
|
+
# to support other trees when Blender supports it
|
|
700
|
+
is_geometry_tree = self._tree.tree.bl_idname in ["GeometryNodeTree"]
|
|
701
|
+
if (
|
|
702
|
+
is_geometry_tree
|
|
703
|
+
and isinstance(other, int)
|
|
704
|
+
and self._default_output_socket.type == "INT"
|
|
705
|
+
):
|
|
666
706
|
return getattr(IntegerMath, operation)(*values)
|
|
667
707
|
else:
|
|
668
708
|
# Math node uses 'floored_modulo' instead of 'modulo'
|
|
@@ -1120,6 +1160,7 @@ class SocketBoolean(SocketBase):
|
|
|
1120
1160
|
layer_selection_field: bool = False,
|
|
1121
1161
|
attribute_domain: _AttributeDomains = "POINT",
|
|
1122
1162
|
default_attribute: str | None = None,
|
|
1163
|
+
is_panel_toggle: bool = False,
|
|
1123
1164
|
):
|
|
1124
1165
|
super().__init__(name, description)
|
|
1125
1166
|
self._set_values(
|
|
@@ -1131,6 +1172,7 @@ class SocketBoolean(SocketBase):
|
|
|
1131
1172
|
structure_type=structure_type,
|
|
1132
1173
|
attribute_domain=attribute_domain,
|
|
1133
1174
|
default_attribute=default_attribute,
|
|
1175
|
+
is_panel_toggle=is_panel_toggle,
|
|
1134
1176
|
)
|
|
1135
1177
|
|
|
1136
1178
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|