nodebpy 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl
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/builder.py +19 -13
- nodebpy/nodes/__init__.py +352 -335
- nodebpy/nodes/attribute.py +362 -307
- nodebpy/nodes/color.py +30 -34
- nodebpy/nodes/converter.py +1987 -2978
- nodebpy/nodes/experimental.py +201 -203
- nodebpy/nodes/geometry.py +4189 -3644
- nodebpy/nodes/grid.py +932 -447
- nodebpy/nodes/group.py +7 -10
- nodebpy/nodes/input.py +1496 -1308
- nodebpy/nodes/interface.py +236 -117
- nodebpy/nodes/manual.py +2022 -0
- nodebpy/nodes/output.py +85 -0
- nodebpy/nodes/texture.py +867 -7
- nodebpy/nodes/vector.py +528 -0
- nodebpy/nodes/zone.py +7 -7
- nodebpy/{nodes/types.py → types.py} +14 -1
- {nodebpy-0.2.0.dist-info → nodebpy-0.2.1.dist-info}/METADATA +2 -2
- nodebpy-0.2.1.dist-info/RECORD +26 -0
- nodebpy/nodes/mesh.py +0 -17
- nodebpy-0.2.0.dist-info/RECORD +0 -25
- {nodebpy-0.2.0.dist-info → nodebpy-0.2.1.dist-info}/WHEEL +0 -0
- {nodebpy-0.2.0.dist-info → nodebpy-0.2.1.dist-info}/entry_points.txt +0 -0
nodebpy/nodes/vector.py
CHANGED
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
import bpy
|
|
4
|
+
|
|
5
|
+
from ..builder import NodeBuilder, SocketLinker
|
|
6
|
+
from ..types import (
|
|
7
|
+
TYPE_INPUT_VALUE,
|
|
8
|
+
TYPE_INPUT_VECTOR,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RadialTiling(NodeBuilder):
|
|
13
|
+
"""Transform Coordinate System for Radial Tiling"""
|
|
14
|
+
|
|
15
|
+
_bl_idname = "ShaderNodeRadialTiling"
|
|
16
|
+
node: bpy.types.ShaderNodeRadialTiling
|
|
17
|
+
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
vector: TYPE_INPUT_VECTOR = None,
|
|
21
|
+
sides: TYPE_INPUT_VALUE = 5.0,
|
|
22
|
+
roundness: TYPE_INPUT_VALUE = 0.0,
|
|
23
|
+
*,
|
|
24
|
+
normalize: bool = False,
|
|
25
|
+
):
|
|
26
|
+
super().__init__()
|
|
27
|
+
key_args = {"Vector": vector, "Sides": sides, "Roundness": roundness}
|
|
28
|
+
self.normalize = normalize
|
|
29
|
+
self._establish_links(**key_args)
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def i_vector(self) -> SocketLinker:
|
|
33
|
+
"""Input socket: Vector"""
|
|
34
|
+
return self._input("Vector")
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def i_sides(self) -> SocketLinker:
|
|
38
|
+
"""Input socket: Sides"""
|
|
39
|
+
return self._input("Sides")
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def i_roundness(self) -> SocketLinker:
|
|
43
|
+
"""Input socket: Roundness"""
|
|
44
|
+
return self._input("Roundness")
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def o_segment_coordinates(self) -> SocketLinker:
|
|
48
|
+
"""Output socket: Segment Coordinates"""
|
|
49
|
+
return self._output("Segment Coordinates")
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def o_segment_id(self) -> SocketLinker:
|
|
53
|
+
"""Output socket: Segment ID"""
|
|
54
|
+
return self._output("Segment ID")
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def o_segment_width(self) -> SocketLinker:
|
|
58
|
+
"""Output socket: Segment Width"""
|
|
59
|
+
return self._output("Segment Width")
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def o_segment_rotation(self) -> SocketLinker:
|
|
63
|
+
"""Output socket: Segment Rotation"""
|
|
64
|
+
return self._output("Segment Rotation")
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def normalize(self) -> bool:
|
|
68
|
+
return self.node.normalize
|
|
69
|
+
|
|
70
|
+
@normalize.setter
|
|
71
|
+
def normalize(self, value: bool):
|
|
72
|
+
self.node.normalize = value
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class VectorCurves(NodeBuilder):
|
|
76
|
+
"""Map input vector components with curves"""
|
|
77
|
+
|
|
78
|
+
_bl_idname = "ShaderNodeVectorCurve"
|
|
79
|
+
node: bpy.types.ShaderNodeVectorCurve
|
|
80
|
+
|
|
81
|
+
def __init__(
|
|
82
|
+
self,
|
|
83
|
+
fac: TYPE_INPUT_VALUE = 1.0,
|
|
84
|
+
vector: TYPE_INPUT_VECTOR = None,
|
|
85
|
+
):
|
|
86
|
+
super().__init__()
|
|
87
|
+
key_args = {"Fac": fac, "Vector": vector}
|
|
88
|
+
|
|
89
|
+
self._establish_links(**key_args)
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def i_fac(self) -> SocketLinker:
|
|
93
|
+
"""Input socket: Factor"""
|
|
94
|
+
return self._input("Fac")
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def i_vector(self) -> SocketLinker:
|
|
98
|
+
"""Input socket: Vector"""
|
|
99
|
+
return self._input("Vector")
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def o_vector(self) -> SocketLinker:
|
|
103
|
+
"""Output socket: Vector"""
|
|
104
|
+
return self._output("Vector")
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class VectorMath(NodeBuilder):
|
|
108
|
+
"""Perform vector math operation"""
|
|
109
|
+
|
|
110
|
+
_bl_idname = "ShaderNodeVectorMath"
|
|
111
|
+
node: bpy.types.ShaderNodeVectorMath
|
|
112
|
+
|
|
113
|
+
def __init__(
|
|
114
|
+
self,
|
|
115
|
+
vector: TYPE_INPUT_VECTOR = None,
|
|
116
|
+
vector_001: TYPE_INPUT_VECTOR = None,
|
|
117
|
+
vector_002: TYPE_INPUT_VECTOR = None,
|
|
118
|
+
scale: TYPE_INPUT_VALUE = 1.0,
|
|
119
|
+
*,
|
|
120
|
+
operation: Literal[
|
|
121
|
+
"ADD",
|
|
122
|
+
"SUBTRACT",
|
|
123
|
+
"MULTIPLY",
|
|
124
|
+
"DIVIDE",
|
|
125
|
+
"MULTIPLY_ADD",
|
|
126
|
+
"CROSS_PRODUCT",
|
|
127
|
+
"PROJECT",
|
|
128
|
+
"REFLECT",
|
|
129
|
+
"REFRACT",
|
|
130
|
+
"FACEFORWARD",
|
|
131
|
+
"DOT_PRODUCT",
|
|
132
|
+
"DISTANCE",
|
|
133
|
+
"LENGTH",
|
|
134
|
+
"SCALE",
|
|
135
|
+
"NORMALIZE",
|
|
136
|
+
"ABSOLUTE",
|
|
137
|
+
"POWER",
|
|
138
|
+
"SIGN",
|
|
139
|
+
"MINIMUM",
|
|
140
|
+
"MAXIMUM",
|
|
141
|
+
"FLOOR",
|
|
142
|
+
"CEIL",
|
|
143
|
+
"FRACTION",
|
|
144
|
+
"MODULO",
|
|
145
|
+
"WRAP",
|
|
146
|
+
"SNAP",
|
|
147
|
+
"SINE",
|
|
148
|
+
"COSINE",
|
|
149
|
+
"TANGENT",
|
|
150
|
+
] = "ADD",
|
|
151
|
+
):
|
|
152
|
+
super().__init__()
|
|
153
|
+
key_args = {
|
|
154
|
+
"Vector": vector,
|
|
155
|
+
"Vector_001": vector_001,
|
|
156
|
+
"Vector_002": vector_002,
|
|
157
|
+
"Scale": scale,
|
|
158
|
+
}
|
|
159
|
+
self.operation = operation
|
|
160
|
+
self._establish_links(**key_args)
|
|
161
|
+
|
|
162
|
+
@classmethod
|
|
163
|
+
def add(
|
|
164
|
+
cls, vector: TYPE_INPUT_VECTOR = None, vector_001: TYPE_INPUT_VECTOR = None
|
|
165
|
+
) -> "VectorMath":
|
|
166
|
+
"""Create Vector Math with operation 'Add'."""
|
|
167
|
+
return cls(operation="ADD", vector=vector, vector_001=vector_001)
|
|
168
|
+
|
|
169
|
+
@classmethod
|
|
170
|
+
def subtract(
|
|
171
|
+
cls, vector: TYPE_INPUT_VECTOR = None, vector_001: TYPE_INPUT_VECTOR = None
|
|
172
|
+
) -> "VectorMath":
|
|
173
|
+
"""Create Vector Math with operation 'Subtract'."""
|
|
174
|
+
return cls(operation="SUBTRACT", vector=vector, vector_001=vector_001)
|
|
175
|
+
|
|
176
|
+
@classmethod
|
|
177
|
+
def multiply(
|
|
178
|
+
cls, vector: TYPE_INPUT_VECTOR = None, vector_001: TYPE_INPUT_VECTOR = None
|
|
179
|
+
) -> "VectorMath":
|
|
180
|
+
"""Create Vector Math with operation 'Multiply'."""
|
|
181
|
+
return cls(operation="MULTIPLY", vector=vector, vector_001=vector_001)
|
|
182
|
+
|
|
183
|
+
@classmethod
|
|
184
|
+
def divide(
|
|
185
|
+
cls, vector: TYPE_INPUT_VECTOR = None, vector_001: TYPE_INPUT_VECTOR = None
|
|
186
|
+
) -> "VectorMath":
|
|
187
|
+
"""Create Vector Math with operation 'Divide'."""
|
|
188
|
+
return cls(operation="DIVIDE", vector=vector, vector_001=vector_001)
|
|
189
|
+
|
|
190
|
+
@classmethod
|
|
191
|
+
def project(
|
|
192
|
+
cls, vector: TYPE_INPUT_VECTOR = None, vector_001: TYPE_INPUT_VECTOR = None
|
|
193
|
+
) -> "VectorMath":
|
|
194
|
+
"""Create Vector Math with operation 'Project'."""
|
|
195
|
+
return cls(operation="PROJECT", vector=vector, vector_001=vector_001)
|
|
196
|
+
|
|
197
|
+
@classmethod
|
|
198
|
+
def reflect(
|
|
199
|
+
cls, vector: TYPE_INPUT_VECTOR = None, vector_001: TYPE_INPUT_VECTOR = None
|
|
200
|
+
) -> "VectorMath":
|
|
201
|
+
"""Create Vector Math with operation 'Reflect'."""
|
|
202
|
+
return cls(operation="REFLECT", vector=vector, vector_001=vector_001)
|
|
203
|
+
|
|
204
|
+
@classmethod
|
|
205
|
+
def refract(
|
|
206
|
+
cls,
|
|
207
|
+
vector: TYPE_INPUT_VECTOR = None,
|
|
208
|
+
vector_001: TYPE_INPUT_VECTOR = None,
|
|
209
|
+
scale: TYPE_INPUT_VALUE = 1.0,
|
|
210
|
+
) -> "VectorMath":
|
|
211
|
+
"""Create Vector Math with operation 'Refract'."""
|
|
212
|
+
return cls(
|
|
213
|
+
operation="REFRACT", vector=vector, vector_001=vector_001, scale=scale
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
@classmethod
|
|
217
|
+
def faceforward(
|
|
218
|
+
cls,
|
|
219
|
+
vector: TYPE_INPUT_VECTOR = None,
|
|
220
|
+
vector_001: TYPE_INPUT_VECTOR = None,
|
|
221
|
+
vector_002: TYPE_INPUT_VECTOR = None,
|
|
222
|
+
) -> "VectorMath":
|
|
223
|
+
"""Create Vector Math with operation 'Faceforward'."""
|
|
224
|
+
return cls(
|
|
225
|
+
operation="FACEFORWARD",
|
|
226
|
+
vector=vector,
|
|
227
|
+
vector_001=vector_001,
|
|
228
|
+
vector_002=vector_002,
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
@classmethod
|
|
232
|
+
def distance(
|
|
233
|
+
cls, vector: TYPE_INPUT_VECTOR = None, vector_001: TYPE_INPUT_VECTOR = None
|
|
234
|
+
) -> "VectorMath":
|
|
235
|
+
"""Create Vector Math with operation 'Distance'."""
|
|
236
|
+
return cls(operation="DISTANCE", vector=vector, vector_001=vector_001)
|
|
237
|
+
|
|
238
|
+
@classmethod
|
|
239
|
+
def length(cls, vector: TYPE_INPUT_VECTOR = None) -> "VectorMath":
|
|
240
|
+
"""Create Vector Math with operation 'Length'."""
|
|
241
|
+
return cls(operation="LENGTH", vector=vector)
|
|
242
|
+
|
|
243
|
+
@classmethod
|
|
244
|
+
def scale(
|
|
245
|
+
cls, vector: TYPE_INPUT_VECTOR = None, scale: TYPE_INPUT_VALUE = 1.0
|
|
246
|
+
) -> "VectorMath":
|
|
247
|
+
"""Create Vector Math with operation 'Scale'."""
|
|
248
|
+
return cls(operation="SCALE", vector=vector, scale=scale)
|
|
249
|
+
|
|
250
|
+
@classmethod
|
|
251
|
+
def normalize(cls, vector: TYPE_INPUT_VECTOR = None) -> "VectorMath":
|
|
252
|
+
"""Create Vector Math with operation 'Normalize'."""
|
|
253
|
+
return cls(operation="NORMALIZE", vector=vector)
|
|
254
|
+
|
|
255
|
+
@classmethod
|
|
256
|
+
def absolute(cls, vector: TYPE_INPUT_VECTOR = None) -> "VectorMath":
|
|
257
|
+
"""Create Vector Math with operation 'Absolute'."""
|
|
258
|
+
return cls(operation="ABSOLUTE", vector=vector)
|
|
259
|
+
|
|
260
|
+
@classmethod
|
|
261
|
+
def power(
|
|
262
|
+
cls, vector: TYPE_INPUT_VECTOR = None, vector_001: TYPE_INPUT_VECTOR = None
|
|
263
|
+
) -> "VectorMath":
|
|
264
|
+
"""Create Vector Math with operation 'Power'."""
|
|
265
|
+
return cls(operation="POWER", vector=vector, vector_001=vector_001)
|
|
266
|
+
|
|
267
|
+
@classmethod
|
|
268
|
+
def sign(cls, vector: TYPE_INPUT_VECTOR = None) -> "VectorMath":
|
|
269
|
+
"""Create Vector Math with operation 'Sign'."""
|
|
270
|
+
return cls(operation="SIGN", vector=vector)
|
|
271
|
+
|
|
272
|
+
@classmethod
|
|
273
|
+
def minimum(
|
|
274
|
+
cls, vector: TYPE_INPUT_VECTOR = None, vector_001: TYPE_INPUT_VECTOR = None
|
|
275
|
+
) -> "VectorMath":
|
|
276
|
+
"""Create Vector Math with operation 'Minimum'."""
|
|
277
|
+
return cls(operation="MINIMUM", vector=vector, vector_001=vector_001)
|
|
278
|
+
|
|
279
|
+
@classmethod
|
|
280
|
+
def maximum(
|
|
281
|
+
cls, vector: TYPE_INPUT_VECTOR = None, vector_001: TYPE_INPUT_VECTOR = None
|
|
282
|
+
) -> "VectorMath":
|
|
283
|
+
"""Create Vector Math with operation 'Maximum'."""
|
|
284
|
+
return cls(operation="MAXIMUM", vector=vector, vector_001=vector_001)
|
|
285
|
+
|
|
286
|
+
@classmethod
|
|
287
|
+
def floor(cls, vector: TYPE_INPUT_VECTOR = None) -> "VectorMath":
|
|
288
|
+
"""Create Vector Math with operation 'Floor'."""
|
|
289
|
+
return cls(operation="FLOOR", vector=vector)
|
|
290
|
+
|
|
291
|
+
@classmethod
|
|
292
|
+
def ceil(cls, vector: TYPE_INPUT_VECTOR = None) -> "VectorMath":
|
|
293
|
+
"""Create Vector Math with operation 'Ceil'."""
|
|
294
|
+
return cls(operation="CEIL", vector=vector)
|
|
295
|
+
|
|
296
|
+
@classmethod
|
|
297
|
+
def fraction(cls, vector: TYPE_INPUT_VECTOR = None) -> "VectorMath":
|
|
298
|
+
"""Create Vector Math with operation 'Fraction'."""
|
|
299
|
+
return cls(operation="FRACTION", vector=vector)
|
|
300
|
+
|
|
301
|
+
@classmethod
|
|
302
|
+
def modulo(
|
|
303
|
+
cls, vector: TYPE_INPUT_VECTOR = None, vector_001: TYPE_INPUT_VECTOR = None
|
|
304
|
+
) -> "VectorMath":
|
|
305
|
+
"""Create Vector Math with operation 'Modulo'."""
|
|
306
|
+
return cls(operation="MODULO", vector=vector, vector_001=vector_001)
|
|
307
|
+
|
|
308
|
+
@classmethod
|
|
309
|
+
def wrap(
|
|
310
|
+
cls,
|
|
311
|
+
vector: TYPE_INPUT_VECTOR = None,
|
|
312
|
+
vector_001: TYPE_INPUT_VECTOR = None,
|
|
313
|
+
vector_002: TYPE_INPUT_VECTOR = None,
|
|
314
|
+
) -> "VectorMath":
|
|
315
|
+
"""Create Vector Math with operation 'Wrap'."""
|
|
316
|
+
return cls(
|
|
317
|
+
operation="WRAP",
|
|
318
|
+
vector=vector,
|
|
319
|
+
vector_001=vector_001,
|
|
320
|
+
vector_002=vector_002,
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
@classmethod
|
|
324
|
+
def snap(
|
|
325
|
+
cls, vector: TYPE_INPUT_VECTOR = None, vector_001: TYPE_INPUT_VECTOR = None
|
|
326
|
+
) -> "VectorMath":
|
|
327
|
+
"""Create Vector Math with operation 'Snap'."""
|
|
328
|
+
return cls(operation="SNAP", vector=vector, vector_001=vector_001)
|
|
329
|
+
|
|
330
|
+
@classmethod
|
|
331
|
+
def sine(cls, vector: TYPE_INPUT_VECTOR = None) -> "VectorMath":
|
|
332
|
+
"""Create Vector Math with operation 'Sine'."""
|
|
333
|
+
return cls(operation="SINE", vector=vector)
|
|
334
|
+
|
|
335
|
+
@classmethod
|
|
336
|
+
def cosine(cls, vector: TYPE_INPUT_VECTOR = None) -> "VectorMath":
|
|
337
|
+
"""Create Vector Math with operation 'Cosine'."""
|
|
338
|
+
return cls(operation="COSINE", vector=vector)
|
|
339
|
+
|
|
340
|
+
@classmethod
|
|
341
|
+
def tangent(cls, vector: TYPE_INPUT_VECTOR = None) -> "VectorMath":
|
|
342
|
+
"""Create Vector Math with operation 'Tangent'."""
|
|
343
|
+
return cls(operation="TANGENT", vector=vector)
|
|
344
|
+
|
|
345
|
+
@property
|
|
346
|
+
def i_vector(self) -> SocketLinker:
|
|
347
|
+
"""Input socket: Vector"""
|
|
348
|
+
return self._input("Vector")
|
|
349
|
+
|
|
350
|
+
@property
|
|
351
|
+
def i_vector_001(self) -> SocketLinker:
|
|
352
|
+
"""Input socket: Vector"""
|
|
353
|
+
return self._input("Vector_001")
|
|
354
|
+
|
|
355
|
+
@property
|
|
356
|
+
def i_vector_002(self) -> SocketLinker:
|
|
357
|
+
"""Input socket: Vector"""
|
|
358
|
+
return self._input("Vector_002")
|
|
359
|
+
|
|
360
|
+
@property
|
|
361
|
+
def i_scale(self) -> SocketLinker:
|
|
362
|
+
"""Input socket: Scale"""
|
|
363
|
+
return self._input("Scale")
|
|
364
|
+
|
|
365
|
+
@property
|
|
366
|
+
def o_vector(self) -> SocketLinker:
|
|
367
|
+
"""Output socket: Vector"""
|
|
368
|
+
return self._output("Vector")
|
|
369
|
+
|
|
370
|
+
@property
|
|
371
|
+
def o_value(self) -> SocketLinker:
|
|
372
|
+
"""Output socket: Value"""
|
|
373
|
+
return self._output("Value")
|
|
374
|
+
|
|
375
|
+
@property
|
|
376
|
+
def operation(
|
|
377
|
+
self,
|
|
378
|
+
) -> Literal[
|
|
379
|
+
"ADD",
|
|
380
|
+
"SUBTRACT",
|
|
381
|
+
"MULTIPLY",
|
|
382
|
+
"DIVIDE",
|
|
383
|
+
"MULTIPLY_ADD",
|
|
384
|
+
"CROSS_PRODUCT",
|
|
385
|
+
"PROJECT",
|
|
386
|
+
"REFLECT",
|
|
387
|
+
"REFRACT",
|
|
388
|
+
"FACEFORWARD",
|
|
389
|
+
"DOT_PRODUCT",
|
|
390
|
+
"DISTANCE",
|
|
391
|
+
"LENGTH",
|
|
392
|
+
"SCALE",
|
|
393
|
+
"NORMALIZE",
|
|
394
|
+
"ABSOLUTE",
|
|
395
|
+
"POWER",
|
|
396
|
+
"SIGN",
|
|
397
|
+
"MINIMUM",
|
|
398
|
+
"MAXIMUM",
|
|
399
|
+
"FLOOR",
|
|
400
|
+
"CEIL",
|
|
401
|
+
"FRACTION",
|
|
402
|
+
"MODULO",
|
|
403
|
+
"WRAP",
|
|
404
|
+
"SNAP",
|
|
405
|
+
"SINE",
|
|
406
|
+
"COSINE",
|
|
407
|
+
"TANGENT",
|
|
408
|
+
]:
|
|
409
|
+
return self.node.operation
|
|
410
|
+
|
|
411
|
+
@operation.setter
|
|
412
|
+
def operation(
|
|
413
|
+
self,
|
|
414
|
+
value: Literal[
|
|
415
|
+
"ADD",
|
|
416
|
+
"SUBTRACT",
|
|
417
|
+
"MULTIPLY",
|
|
418
|
+
"DIVIDE",
|
|
419
|
+
"MULTIPLY_ADD",
|
|
420
|
+
"CROSS_PRODUCT",
|
|
421
|
+
"PROJECT",
|
|
422
|
+
"REFLECT",
|
|
423
|
+
"REFRACT",
|
|
424
|
+
"FACEFORWARD",
|
|
425
|
+
"DOT_PRODUCT",
|
|
426
|
+
"DISTANCE",
|
|
427
|
+
"LENGTH",
|
|
428
|
+
"SCALE",
|
|
429
|
+
"NORMALIZE",
|
|
430
|
+
"ABSOLUTE",
|
|
431
|
+
"POWER",
|
|
432
|
+
"SIGN",
|
|
433
|
+
"MINIMUM",
|
|
434
|
+
"MAXIMUM",
|
|
435
|
+
"FLOOR",
|
|
436
|
+
"CEIL",
|
|
437
|
+
"FRACTION",
|
|
438
|
+
"MODULO",
|
|
439
|
+
"WRAP",
|
|
440
|
+
"SNAP",
|
|
441
|
+
"SINE",
|
|
442
|
+
"COSINE",
|
|
443
|
+
"TANGENT",
|
|
444
|
+
],
|
|
445
|
+
):
|
|
446
|
+
self.node.operation = value
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
class VectorRotate(NodeBuilder):
|
|
450
|
+
"""Rotate a vector around a pivot point (center)"""
|
|
451
|
+
|
|
452
|
+
_bl_idname = "ShaderNodeVectorRotate"
|
|
453
|
+
node: bpy.types.ShaderNodeVectorRotate
|
|
454
|
+
|
|
455
|
+
def __init__(
|
|
456
|
+
self,
|
|
457
|
+
vector: TYPE_INPUT_VECTOR = None,
|
|
458
|
+
center: TYPE_INPUT_VECTOR = None,
|
|
459
|
+
axis: TYPE_INPUT_VECTOR = None,
|
|
460
|
+
angle: TYPE_INPUT_VALUE = 0.0,
|
|
461
|
+
rotation: TYPE_INPUT_VECTOR = None,
|
|
462
|
+
*,
|
|
463
|
+
rotation_type: Literal[
|
|
464
|
+
"AXIS_ANGLE", "X_AXIS", "Y_AXIS", "Z_AXIS", "EULER_XYZ"
|
|
465
|
+
] = "AXIS_ANGLE",
|
|
466
|
+
invert: bool = False,
|
|
467
|
+
):
|
|
468
|
+
super().__init__()
|
|
469
|
+
key_args = {
|
|
470
|
+
"Vector": vector,
|
|
471
|
+
"Center": center,
|
|
472
|
+
"Axis": axis,
|
|
473
|
+
"Angle": angle,
|
|
474
|
+
"Rotation": rotation,
|
|
475
|
+
}
|
|
476
|
+
self.rotation_type = rotation_type
|
|
477
|
+
self.invert = invert
|
|
478
|
+
self._establish_links(**key_args)
|
|
479
|
+
|
|
480
|
+
@property
|
|
481
|
+
def i_vector(self) -> SocketLinker:
|
|
482
|
+
"""Input socket: Vector"""
|
|
483
|
+
return self._input("Vector")
|
|
484
|
+
|
|
485
|
+
@property
|
|
486
|
+
def i_center(self) -> SocketLinker:
|
|
487
|
+
"""Input socket: Center"""
|
|
488
|
+
return self._input("Center")
|
|
489
|
+
|
|
490
|
+
@property
|
|
491
|
+
def i_axis(self) -> SocketLinker:
|
|
492
|
+
"""Input socket: Axis"""
|
|
493
|
+
return self._input("Axis")
|
|
494
|
+
|
|
495
|
+
@property
|
|
496
|
+
def i_angle(self) -> SocketLinker:
|
|
497
|
+
"""Input socket: Angle"""
|
|
498
|
+
return self._input("Angle")
|
|
499
|
+
|
|
500
|
+
@property
|
|
501
|
+
def i_rotation(self) -> SocketLinker:
|
|
502
|
+
"""Input socket: Rotation"""
|
|
503
|
+
return self._input("Rotation")
|
|
504
|
+
|
|
505
|
+
@property
|
|
506
|
+
def o_vector(self) -> SocketLinker:
|
|
507
|
+
"""Output socket: Vector"""
|
|
508
|
+
return self._output("Vector")
|
|
509
|
+
|
|
510
|
+
@property
|
|
511
|
+
def rotation_type(
|
|
512
|
+
self,
|
|
513
|
+
) -> Literal["AXIS_ANGLE", "X_AXIS", "Y_AXIS", "Z_AXIS", "EULER_XYZ"]:
|
|
514
|
+
return self.node.rotation_type
|
|
515
|
+
|
|
516
|
+
@rotation_type.setter
|
|
517
|
+
def rotation_type(
|
|
518
|
+
self, value: Literal["AXIS_ANGLE", "X_AXIS", "Y_AXIS", "Z_AXIS", "EULER_XYZ"]
|
|
519
|
+
):
|
|
520
|
+
self.node.rotation_type = value
|
|
521
|
+
|
|
522
|
+
@property
|
|
523
|
+
def invert(self) -> bool:
|
|
524
|
+
return self.node.invert
|
|
525
|
+
|
|
526
|
+
@invert.setter
|
|
527
|
+
def invert(self, value: bool):
|
|
528
|
+
self.node.invert = value
|
nodebpy/nodes/zone.py
CHANGED
|
@@ -6,7 +6,7 @@ from bpy.types import NodeSocket
|
|
|
6
6
|
|
|
7
7
|
from nodebpy.builder import NodeBuilder, SocketLinker
|
|
8
8
|
|
|
9
|
-
from
|
|
9
|
+
from ..types import (
|
|
10
10
|
LINKABLE,
|
|
11
11
|
TYPE_INPUT_BOOLEAN,
|
|
12
12
|
TYPE_INPUT_GEOMETRY,
|
|
@@ -194,7 +194,7 @@ class BaseSimulationZone(BaseZone):
|
|
|
194
194
|
class SimulationInput(BaseSimulationZone, BaseZoneInput):
|
|
195
195
|
"""Simulation Input node"""
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
_bl_idname = "GeometryNodeSimulationInput"
|
|
198
198
|
node: bpy.types.GeometryNodeSimulationInput
|
|
199
199
|
|
|
200
200
|
@property
|
|
@@ -206,7 +206,7 @@ class SimulationInput(BaseSimulationZone, BaseZoneInput):
|
|
|
206
206
|
class SimulationOutput(BaseSimulationZone, BaseZoneOutput):
|
|
207
207
|
"""Simulation Output node"""
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
_bl_idname = "GeometryNodeSimulationOutput"
|
|
210
210
|
node: bpy.types.GeometryNodeSimulationOutput
|
|
211
211
|
|
|
212
212
|
@property
|
|
@@ -257,7 +257,7 @@ class BaseRepeatZone(BaseZone):
|
|
|
257
257
|
class RepeatInput(BaseRepeatZone, BaseZoneInput):
|
|
258
258
|
"""Repeat Input node"""
|
|
259
259
|
|
|
260
|
-
|
|
260
|
+
_bl_idname = "GeometryNodeRepeatInput"
|
|
261
261
|
node: bpy.types.GeometryNodeRepeatInput
|
|
262
262
|
|
|
263
263
|
def __init__(self, iterations: TYPE_INPUT_INT = 1):
|
|
@@ -280,14 +280,14 @@ class RepeatInput(BaseRepeatZone, BaseZoneInput):
|
|
|
280
280
|
class RepeatOutput(BaseRepeatZone, BaseZoneOutput):
|
|
281
281
|
"""Repeat Output node"""
|
|
282
282
|
|
|
283
|
-
|
|
283
|
+
_bl_idname = "GeometryNodeRepeatOutput"
|
|
284
284
|
node: bpy.types.GeometryNodeRepeatOutput
|
|
285
285
|
|
|
286
286
|
|
|
287
287
|
class ForEachGeometryElementInput(NodeBuilder):
|
|
288
288
|
"""For Each Geometry Element Input node"""
|
|
289
289
|
|
|
290
|
-
|
|
290
|
+
_bl_idname = "GeometryNodeForeachGeometryElementInput"
|
|
291
291
|
node: bpy.types.GeometryNodeForeachGeometryElementInput
|
|
292
292
|
|
|
293
293
|
def __init__(
|
|
@@ -332,7 +332,7 @@ class ForEachGeometryElementInput(NodeBuilder):
|
|
|
332
332
|
class ForEachGeometryElementOutput(NodeBuilder):
|
|
333
333
|
"""For Each Geometry Element Output node"""
|
|
334
334
|
|
|
335
|
-
|
|
335
|
+
_bl_idname = "GeometryNodeForeachGeometryElementOutput"
|
|
336
336
|
node: bpy.types.GeometryNodeForeachGeometryElementOutput
|
|
337
337
|
|
|
338
338
|
def __init__(
|
|
@@ -6,6 +6,8 @@ from typing import Literal
|
|
|
6
6
|
from bpy.types import (
|
|
7
7
|
NodeSocket,
|
|
8
8
|
NodeSocketBool,
|
|
9
|
+
NodeSocketBundle,
|
|
10
|
+
NodeSocketClosure,
|
|
9
11
|
NodeSocketCollection,
|
|
10
12
|
NodeSocketColor,
|
|
11
13
|
NodeSocketFloat,
|
|
@@ -22,7 +24,7 @@ from bpy.types import (
|
|
|
22
24
|
from mathutils import Euler
|
|
23
25
|
|
|
24
26
|
if typing.TYPE_CHECKING:
|
|
25
|
-
from
|
|
27
|
+
from .builder import NodeBuilder, SocketLinker
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
def _is_default_value(value: TYPE_INPUT_ALL):
|
|
@@ -67,6 +69,17 @@ TYPE_INPUT_GRID = typing.Union[
|
|
|
67
69
|
TYPE_INPUT_VALUE, TYPE_INPUT_VECTOR, TYPE_INPUT_BOOLEAN, TYPE_INPUT_INT
|
|
68
70
|
]
|
|
69
71
|
TYPE_INPUT_MENU = typing.Union[LINKABLE, NodeSocketMenu]
|
|
72
|
+
TYPE_INPUT_BUNDLE = typing.Union[LINKABLE, NodeSocketBundle]
|
|
73
|
+
TYPE_INPUT_CLOSURE = typing.Union[LINKABLE, NodeSocketClosure]
|
|
74
|
+
|
|
75
|
+
TYPE_INPUT_DATA = typing.Union[
|
|
76
|
+
TYPE_INPUT_VALUE,
|
|
77
|
+
TYPE_INPUT_INT,
|
|
78
|
+
TYPE_INPUT_BOOLEAN,
|
|
79
|
+
TYPE_INPUT_VECTOR,
|
|
80
|
+
TYPE_INPUT_ROTATION,
|
|
81
|
+
TYPE_INPUT_MATRIX,
|
|
82
|
+
]
|
|
70
83
|
|
|
71
84
|
TYPE_INPUT_ALL = typing.Union[
|
|
72
85
|
TYPE_INPUT_VALUE,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: nodebpy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Build nodes in Blender with code
|
|
5
5
|
Author: Brady Johnston
|
|
6
6
|
Author-email: Brady Johnston <brady.johnston@me.com>
|
|
@@ -76,7 +76,7 @@ with TreeBuilder("AnotherTree") as tree:
|
|
|
76
76
|
|
|
77
77
|
_ = (
|
|
78
78
|
count
|
|
79
|
-
>> n.Points(position=n.RandomValue.vector(min
|
|
79
|
+
>> n.Points(position=n.RandomValue.vector(min=-1))
|
|
80
80
|
>> n.InstanceOnPoints(instance=n.Cube(), rotation=rotation)
|
|
81
81
|
>> n.SetPosition(
|
|
82
82
|
position=n.Position() * 2.0 + (0, 0.2, 0.3),
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
nodebpy/__init__.py,sha256=AcXaVEPnvX1BlraPSSQ-0NR-Ip6cI0WNRqz84xvrTok,285
|
|
2
|
+
nodebpy/arrange.py,sha256=xBHf-lYlvr-BCdI0gHhEn1ETWjEQyYmzgmhIZ1RYal8,11020
|
|
3
|
+
nodebpy/builder.py,sha256=n4Qje1UAWUvOVCFv7KRaF6jDw6kEZPaVcWNLrqNHKlU,52460
|
|
4
|
+
nodebpy/nodes/__init__.py,sha256=OKVeUcCUjhmqsEsGKhgkCVe0iq2dWEqJCgcogx9RShM,12528
|
|
5
|
+
nodebpy/nodes/attribute.py,sha256=hme17msRejaqGHKDwvauHdCKMq7OLZhhi1Ax9Oxb7Wo,15043
|
|
6
|
+
nodebpy/nodes/color.py,sha256=ye1LkcJuebjMlJ8OUlKepSOe8-dhImgoL1uXFG1NamE,1652
|
|
7
|
+
nodebpy/nodes/converter.py,sha256=rzp3LmQ8uiDW1sDZg9x-LWkphBFzUn9dCgzETPI5Cdc,99014
|
|
8
|
+
nodebpy/nodes/experimental.py,sha256=Gxd2lKD5Hr4ClSmFojeZpZQr5AapQebDgTeO9R6EqxE,9561
|
|
9
|
+
nodebpy/nodes/geometry.py,sha256=C1H9JIGtzmzbJY7rsEf8c9PkX6Ja0JUKRcAI6uLS-l4,177510
|
|
10
|
+
nodebpy/nodes/grid.py,sha256=Px92tPr9w-_IWdAzaMMaIbVeRAHWFTQF3QJ1FYPMqGc,50345
|
|
11
|
+
nodebpy/nodes/group.py,sha256=PzQ20PrzgtqgQ2XRU7K1pqA9mW5wyt54bUIaqHjdqD0,289
|
|
12
|
+
nodebpy/nodes/input.py,sha256=i4CmSe4mBxlIru-BnzwUH1C_95Op5JpIMd-QiZY-FWE,60082
|
|
13
|
+
nodebpy/nodes/interface.py,sha256=jobDdF_DpioS25-RfnyPLiKcA40ZfwNhOjdLATBHdDk,14947
|
|
14
|
+
nodebpy/nodes/manual.py,sha256=zhfcbWJxB-lMB6q_fvmPjnYCRbS52gY-BI1171rIu9U,59625
|
|
15
|
+
nodebpy/nodes/output.py,sha256=py1SgNLQfwTG31KQCHFZn6lC5qg8NixMAoJ1KhnT7XQ,2138
|
|
16
|
+
nodebpy/nodes/texture.py,sha256=JyjsE8WrVJ4wpx3xO6uaJ5A8ll7N6FtWBQs0comAD7s,25526
|
|
17
|
+
nodebpy/nodes/vector.py,sha256=ULEOGx71OCD1Rz2egzkz5RhaKc5huC-LUjghovrnPbQ,15283
|
|
18
|
+
nodebpy/nodes/zone.py,sha256=Rc97fUW1PmteAzxODCEpGJbVbfl9PTgnnBHSoBa8188,13543
|
|
19
|
+
nodebpy/screenshot.py,sha256=gXAwGfeK05YL9XIpghv5nQ5cXVgtR35wnLnTVDAh08g,18885
|
|
20
|
+
nodebpy/screenshot_subprocess.py,sha256=bmuyjedROCasEDI-JdjXWVsYoEX5I-asE3KxMVR30qM,15364
|
|
21
|
+
nodebpy/sockets.py,sha256=eU3p0IdCkYQeVRp8XkkDuOR38JTIzniTXKhsXQgx29Q,1011
|
|
22
|
+
nodebpy/types.py,sha256=4IGYzFquYFPNj_h-yKz-VycdodozdaaHSJ9gX6MchTs,10848
|
|
23
|
+
nodebpy-0.2.1.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
24
|
+
nodebpy-0.2.1.dist-info/entry_points.txt,sha256=XvODbWiwSnneYWIYjxFJZmXdntQnapg59Ye2LtCKEN4,42
|
|
25
|
+
nodebpy-0.2.1.dist-info/METADATA,sha256=sHU0fV0C_fUtJaPVR8-xkwxX_6FQ-TieLoT7IZRBdkA,6289
|
|
26
|
+
nodebpy-0.2.1.dist-info/RECORD,,
|
nodebpy/nodes/mesh.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Auto-generated Blender Geometry Node classes.
|
|
3
|
-
|
|
4
|
-
DO NOT EDIT THIS FILE MANUALLY.
|
|
5
|
-
This file is generated by molecularnodes/nodes/generator.py
|
|
6
|
-
|
|
7
|
-
To regenerate: Run generator.py from within Blender
|
|
8
|
-
|
|
9
|
-
KNOWN LIMITATIONS:
|
|
10
|
-
- Dynamic multi-input/output sockets are not yet supported
|
|
11
|
-
(these are the unnamed sockets that appear in the UI for nodes like
|
|
12
|
-
"Evaluate Closure", "Join Geometry", etc. that allow dragging in
|
|
13
|
-
multiple connections)
|
|
14
|
-
- TODO: Add support for dynamic socket creation
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
from __future__ import annotations
|