fix crash invalid input
[convexer.git] / config.py
1 # Convexer default configuration .py
2 #
3 # config dict purpose
4 # ------------------------------------------------------------------------------
5 # cxr_shaders Defines shader names
6 # cxr_graph_mapping Contains a graph to traverse Blender shader nodes
7 # cxr_shader_params Material shader properties and groups
8 # cxr_entities Entity info
9
10 # Shader names
11 #
12 cxr_shaders = \
13 {
14 "LightMappedGeneric": { "name": "Light Mapped" },
15 "VertexLitGeneric": { "name": "Vertex Lit" },
16 "UnlitGeneric": { "name": "Unlit" },
17 "Builtin": { "name": "Builtin" }
18 }
19
20 # Shader graph mapping
21 # ------------------------------------------------------------------------------
22
23 def material_tex_image(v):
24 return {
25 "ShaderNodeTexImage":
26 {
27 "image": F"${v}"
28 }
29 }
30
31 cxr_graph_mapping = \
32 {
33 "ShaderNodeBsdfPrincipled":
34 {
35 "Base Color":
36 {
37 "ShaderNodeMixRGB":
38 {
39 "Color1": material_tex_image("basetexture"),
40 "Color2": material_tex_image("decaltexture")
41 },
42 "ShaderNodeTexImage":
43 {
44 "image":"$basetexture"
45 },
46 "default":
47 [("VertexLitGeneric","$color2"),\
48 ("UnlitGeneric","$color2"),\
49 ("LightMappedGeneric","$color")]
50 },
51 "Normal":
52 {
53 "ShaderNodeNormalMap":
54 {
55 "Color": material_tex_image("bumpmap")
56 }
57 }
58 }
59 }
60
61 # Shader keyvalues / material properties
62 # ------------------------------------------------------------------------------
63
64 cxr_shader_params = \
65 {
66 "Textures":
67 {
68 "type": "ui",
69 "shaders": ("UnlitGeneric","VertexLitGeneric","LightMappedGeneric"),
70
71 "$basetexture":
72 {
73 "name": "Base Texture",
74 "type": "intrinsic",
75 "default": None
76 },
77 "$decaltexture":
78 {
79 "name": "Decal Texture",
80 "type": "intrinsic",
81 "default": None,
82
83 "$decalblendmode":
84 {
85 "name": "Blend Mode",
86 "type": "enum",
87 "items": [
88 ('0',"AlphaOver","Default",'',0),
89 ('1',"Multiply","",'',1),
90 ('2',"Modulate","",'',2),
91 ('3',"Additive","",'',3)
92 ],
93 "default": 0,
94 "always": True
95 }
96 },
97 "$bumpmap":
98 {
99 "name": "Normal Map",
100 "type": "intrinsic",
101 "flags": NBVTF_TEXTUREFLAGS_NORMAL, # OpenGL (correct) normal maps.
102 "default": None
103 }
104 },
105 "$color":
106 {
107 "name": "Color",
108 "type": "intrinsic",
109 "default": None,
110 "exponent": 1.0
111 },
112 "$color2":
113 {
114 "name": "Color2",
115 "type": "intrinsic",
116 "default": None,
117 "exponent": 1.0
118 },
119 "Lighting":
120 {
121 "type": "ui",
122 "shaders": ("VertexLitGeneric", "LightMappedGeneric"),
123
124 "$phong":
125 {
126 "name": "Phong",
127 "type": "bool",
128 "default": False,
129
130 "$phongexponent":
131 {
132 "name": "Exponent",
133 "type": "float",
134 "default": 5.0
135 },
136 "$phongboost":
137 {
138 "name": "Boost",
139 "type": "float",
140 "default": 1.0
141 },
142 "$phongfresnelranges":
143 {
144 "name": "Fresnel Ranges",
145 "type": "vector",
146 "default":(1.0,1.0,1.0)
147 },
148 "$basemapalphaphongmask":
149 {
150 "name": "Base alpha mask",
151 "type": "bool",
152 "default": False
153 }
154 },
155 "$envmap":
156 {
157 "name": "Cubemap",
158 "type": "string",
159 "default": "",
160
161 "$envmaptint":
162 {
163 "name": "Tint",
164 "type": "vector",
165 "subtype": 'COLOR',
166 "default": (1.0,1.0,1.0)
167 },
168 "$envmaplightscale":
169 {
170 "name": "Light Scale",
171 "type": "float",
172 "default": 0.0
173 },
174 "$envmaplightscaleminmax":
175 {
176 "name": "Min/Max",
177 "type": "vector",
178 "default": (0.0,1.0)
179 },
180 "$normalmapalphaenvmapmask":
181 {
182 "name": "Normal map mask",
183 "type": "bool",
184 "default": False
185 },
186 "$basealphaenvmapmask":
187 {
188 "name": "Base map mask",
189 "type": "bool",
190 "default": False
191 }
192 },
193 "$selfillum":
194 {
195 "name": "Emission",
196 "type": "bool",
197 "default": False
198 }
199 },
200 "Transparency":
201 {
202 "type": "ui",
203 "shaders": ("UnlitGeneric","VertexLitGeneric","LightMappedGeneric"),
204
205 "$translucent":
206 {
207 "name": "Translucent",
208 "type": "bool",
209 "default": False,
210
211 "$additive":
212 {
213 "name": "Additive",
214 "type": "bool",
215 "default": False
216 }
217 },
218 "$alphatest":
219 {
220 "name": "Alpha Test",
221 "type": "bool",
222 "default": False,
223
224 "$alphatestreference":
225 {
226 "name": "Step",
227 "type": "float",
228 "default": 0.5
229 }
230 },
231 "$nocull":
232 {
233 "name": "No Cull",
234 "type": "bool",
235 "default": False
236 }
237 }
238 }
239
240 # Entity KV definitions
241 # Note: currently blender doesnt support enum or bool types for IDProperties,
242 # so unfortunately the panel UI is a little bit bad to work with.
243 # ------------------------------------------------------------------------------
244
245 cxr_entities = \
246 {
247 # Builtin/intrinsic entities, you probably dont want to modify these
248 "light": { "keyvalues": ent_lights },
249 "light_spot": { "keyvalues": ent_lights },
250 "light_environment": { "keyvalues": ent_lights },
251 "env_cubemap": { "keyvalues": ent_cubemap },
252 "prop_static": { "keyvalues": ent_prop },
253 "sky_camera": { "keyvalues": ent_sky_camera },
254
255 # CSGO.fgd
256 # --------
257 "info_player_counterterrorist":
258 {
259 "gizmo": [],
260 "allow": ('EMPTY',),
261 "keyvalues": cxr_baseclass([ent_transform],\
262 {
263 "priority": {"type": "int", "default": 0 },
264 "enabled": {"type": "int", "default": 1 },
265 })
266 },
267 "info_player_terrorist":
268 {
269 "gizmo": [],
270 "allow": ('EMPTY',),
271 "keyvalues": cxr_baseclass([ent_transform],\
272 {
273 "priority": {"type": "int", "default": 0 },
274 "enabled": {"type": "int", "default": 1 },
275 })
276 },
277
278 # Brush entites
279 # -------------
280 "func_buyzone":
281 {
282 "allow": ('MESH',),
283 "keyvalues":
284 {
285 "TeamNum": {"type": "int", "default": 0 }
286 }
287 },
288 "func_bomb_target":
289 {
290 "allow": ('MESH',),
291 "keyvalues": {}
292 },
293 "func_detail":
294 {
295 "allow": ('MESH',),
296 "keyvalues": {}
297 },
298 "trigger_hurt":
299 {
300 "allow": ('MESH',),
301 "keyvalues":
302 {
303 "damage": { "type":"int", "default": 10},
304 "damagecap": { "type":"int", "default": 20},
305 "damagetype": { "type":"int", "default": 0},
306 "damagemodel": { "type":"int", "default": 0}
307 }
308 }
309 }