nodebpy 0.1.1__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 +786 -316
- nodebpy/nodes/__init__.py +641 -10
- nodebpy/nodes/attribute.py +345 -389
- nodebpy/nodes/color.py +72 -0
- nodebpy/nodes/converter.py +3527 -0
- nodebpy/nodes/experimental.py +312 -0
- nodebpy/nodes/geometry.py +3677 -4717
- nodebpy/nodes/grid.py +1713 -0
- nodebpy/nodes/group.py +17 -0
- nodebpy/nodes/input.py +1821 -316
- nodebpy/nodes/interface.py +519 -0
- nodebpy/nodes/manual.py +2022 -0
- nodebpy/nodes/output.py +85 -0
- nodebpy/nodes/texture.py +930 -0
- nodebpy/nodes/vector.py +528 -0
- nodebpy/nodes/zone.py +442 -0
- nodebpy/screenshot.py +2 -1
- nodebpy/sockets.py +12 -12
- nodebpy/types.py +445 -0
- {nodebpy-0.1.1.dist-info → nodebpy-0.2.1.dist-info}/METADATA +5 -5
- nodebpy-0.2.1.dist-info/RECORD +26 -0
- nodebpy/nodes/curve.py +0 -2006
- nodebpy/nodes/manually_specified.py +0 -1382
- nodebpy/nodes/mesh.py +0 -1408
- nodebpy/nodes/types.py +0 -119
- nodebpy/nodes/utilities.py +0 -2344
- nodebpy-0.1.1.dist-info/RECORD +0 -19
- {nodebpy-0.1.1.dist-info → nodebpy-0.2.1.dist-info}/WHEEL +0 -0
- {nodebpy-0.1.1.dist-info → nodebpy-0.2.1.dist-info}/entry_points.txt +0 -0
nodebpy/nodes/vector.py
ADDED
|
@@ -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
|