nodebpy 0.1.1__py3-none-any.whl → 0.2.0__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/nodes/color.py ADDED
@@ -0,0 +1,76 @@
1
+ import bpy
2
+
3
+ from ..builder import NodeBuilder, SocketLinker
4
+ from .types import TYPE_INPUT_COLOR, TYPE_INPUT_VALUE
5
+
6
+
7
+ class RGBCurves(NodeBuilder):
8
+ """Apply color corrections for each color channel"""
9
+
10
+ # TODO: add support for custom curves along with FloatCurve
11
+
12
+ name = "ShaderNodeRGBCurve"
13
+ node: bpy.types.ShaderNodeRGBCurve
14
+
15
+ def __init__(
16
+ self,
17
+ factor: TYPE_INPUT_VALUE = 1.0,
18
+ color: TYPE_INPUT_COLOR = (1.0, 1.0, 1.0, 1.0),
19
+ **kwargs,
20
+ ):
21
+ super().__init__()
22
+ key_args = {"Factor": factor, "Color": color}
23
+ key_args.update(kwargs)
24
+
25
+ self._establish_links(**key_args)
26
+
27
+ @property
28
+ def i_factor(self) -> SocketLinker:
29
+ """Input socket: Factor"""
30
+ return self._input("Fac")
31
+
32
+ @property
33
+ def i_color(self) -> SocketLinker:
34
+ """Input socket: Color"""
35
+ return self._input("Color")
36
+
37
+ @property
38
+ def o_color(self) -> SocketLinker:
39
+ """Output socket: Color"""
40
+ return self._output("Color")
41
+
42
+
43
+ class Gamma(NodeBuilder):
44
+ """Apply a gamma correction"""
45
+
46
+ name = "ShaderNodeGamma"
47
+ node: bpy.types.ShaderNodeGamma
48
+
49
+ def __init__(
50
+ self,
51
+ color: TYPE_INPUT_COLOR = (
52
+ 1.0,
53
+ 1.0,
54
+ 1.0,
55
+ 1.0,
56
+ ),
57
+ gamma: TYPE_INPUT_VALUE = 1.0,
58
+ ):
59
+ super().__init__()
60
+ key_args = {"Color": color, "Gamma": gamma}
61
+ self._establish_links(**key_args)
62
+
63
+ @property
64
+ def i_color(self) -> SocketLinker:
65
+ """Input socket: Color"""
66
+ return self._input("Color")
67
+
68
+ @property
69
+ def i_gamma(self) -> SocketLinker:
70
+ """Input socket: Gamma"""
71
+ return self._input("Gamma")
72
+
73
+ @property
74
+ def o_color(self) -> SocketLinker:
75
+ """Output socket: Color"""
76
+ return self._output("Color")