-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.py
77 lines (68 loc) · 2.77 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Copyright (C) 2023 Spencer Magnusson
# Created by Spencer Magnusson
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from . import custom_node_eval as custom
import bpy
IS_BPY_V3 = bpy.app.version < (4, 0, 0)
ALPHA_THRESHOLD = 0.7
FIRST_INPUT = ('inputs', 0)
UNIVERSAL_MAP = {
'ShaderNodeRGB': ('outputs', 0),
'ShaderNodeValue': ('outputs', 0),
'ShaderNodeMapRange': FIRST_INPUT,
'ShaderNodeSeparateColor': FIRST_INPUT,
'NodeGroupOutput': FIRST_INPUT,
'ShaderNodeOutputMaterial': FIRST_INPUT,
'ShaderNodeBrightContrast': FIRST_INPUT,
'ShaderNodeGamma': FIRST_INPUT,
'ShaderNodeHueSaturation': ('inputs', 4),
'ShaderNodeInvert': ('inputs', 1),
'ShaderNodeRGBCurve': ('inputs', 1),
'ShaderNodeClamp': custom.clamp_node,
'ShaderNodeTexImage': custom.image_node,
'ShaderNodeTexEnvironment': custom.image_node,
'ShaderNodeValToRGB': custom.color_ramp,
'ShaderNodeMix': custom.mix_node,
}
ALBEDO_MAP = {
'ShaderNodeBsdfPrincipled': FIRST_INPUT,
'ShaderNodeEmission': FIRST_INPUT,
'ShaderNodeBsdfToon': FIRST_INPUT,
'ShaderNodeBsdfAnisotropic': FIRST_INPUT,
'ShaderNodeBsdfDiffuse': FIRST_INPUT,
'ShaderNodeBsdfGlass': FIRST_INPUT,
'ShaderNodeBsdfGlossy': FIRST_INPUT,
'ShaderNodeBsdfHair': FIRST_INPUT,
'ShaderNodeBsdfHairPrincipled': FIRST_INPUT,
'ShaderNodeBsdfRefraction': FIRST_INPUT,
'ShaderNodeSubsurfaceScattering': FIRST_INPUT,
'ShaderNodeBsdfTranslucent': FIRST_INPUT,
'ShaderNodeBsdfVelvet': FIRST_INPUT,
}
METALLIC_MAP = {
'ShaderNodeBsdfPrincipled': ('inputs', 6) if IS_BPY_V3 else ('inputs', 1),
}
ROUGHNESS_MAP = {
'ShaderNodeBsdfPrincipled': ('inputs', 9) if IS_BPY_V3 else ('inputs', 2),
'ShaderNodeBsdfToon': ('inputs', 1),
'ShaderNodeBsdfAnisotropic': ('inputs', 1),
'ShaderNodeBsdfDiffuse': ('inputs', 1),
'ShaderNodeBsdfGlass': ('inputs', 1),
'ShaderNodeBsdfGlossy': ('inputs', 1),
'ShaderNodeBsdfHairPrincipled': ('inputs', 5),
'ShaderNodeBsdfRefraction': ('inputs', 1),
'ShaderNodeBsdfVelvet': ('inputs', 1),
}
ALBEDO_MAP.update(UNIVERSAL_MAP)
METALLIC_MAP.update(UNIVERSAL_MAP)
ROUGHNESS_MAP.update(UNIVERSAL_MAP)