Skip to content

Commit f0134f4

Browse files
marko-koljancicMarko Koljancicpre-commit-ci[bot]
authored
Add Solarxy project config schema (solarxy.toml) (#5721)
* Add Solarxy project config schema (solarxy.toml) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Marko Koljancic <marko.koljancic@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 97182e5 commit f0134f4

3 files changed

Lines changed: 253 additions & 0 deletions

File tree

src/api/json/catalog.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6492,6 +6492,12 @@
64926492
],
64936493
"url": "https://www.schemastore.org/snowflake-connections.json"
64946494
},
6495+
{
6496+
"name": "Solarxy project config",
6497+
"description": "Solarxy 3D model viewer and validator project configuration",
6498+
"fileMatch": ["solarxy.toml"],
6499+
"url": "https://www.schemastore.org/solarxy-config.json"
6500+
},
64956501
{
64966502
"name": "Solidarity",
64976503
"description": "CLI config for enforcing environment settings",
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://www.schemastore.org/solarxy-config.json",
4+
"additionalProperties": false,
5+
"definitions": {
6+
"AssetCategory": {
7+
"enum": ["hero", "prop", "environment", "default"],
8+
"type": "string"
9+
},
10+
"Budgets": {
11+
"additionalProperties": false,
12+
"properties": {
13+
"default": {
14+
"default": 30000,
15+
"minimum": 0.0,
16+
"type": "integer"
17+
},
18+
"environment": {
19+
"default": 50000,
20+
"minimum": 0.0,
21+
"type": "integer"
22+
},
23+
"hero": {
24+
"default": 100000,
25+
"minimum": 0.0,
26+
"type": "integer"
27+
},
28+
"prop": {
29+
"default": 20000,
30+
"minimum": 0.0,
31+
"type": "integer"
32+
}
33+
},
34+
"type": "object"
35+
},
36+
"ClassifierRule": {
37+
"additionalProperties": false,
38+
"properties": {
39+
"category": {
40+
"$ref": "#/definitions/AssetCategory"
41+
},
42+
"pattern": {
43+
"type": "string"
44+
}
45+
},
46+
"required": ["category", "pattern"],
47+
"type": "object"
48+
},
49+
"FilenameClassifier": {
50+
"additionalProperties": false,
51+
"properties": {
52+
"rules": {
53+
"default": [],
54+
"items": {
55+
"$ref": "#/definitions/ClassifierRule"
56+
},
57+
"type": "array"
58+
}
59+
},
60+
"type": "object"
61+
},
62+
"ReviewSettings": {
63+
"additionalProperties": false,
64+
"description": "Project-level review-system settings. User-level prefs (display name for the `author` field, panel open default) live in [`crate::preferences::ReviewPrefs`].",
65+
"properties": {
66+
"sidecar_dir": {
67+
"default": null,
68+
"description": "Override location of the `.solarxy-review.json` sidecar. `None` (default) ⇒ sibling to the model file. Relative paths are resolved against the model's parent directory (so `\".solarxy\"` produces `<model_dir>/.solarxy/<stem>.solarxy-review.json`). Absolute paths are used as-is.",
69+
"type": ["string", "null"]
70+
}
71+
},
72+
"type": "object"
73+
},
74+
"ValidationConfig": {
75+
"additionalProperties": false,
76+
"properties": {
77+
"allow_open_mesh": {
78+
"default": false,
79+
"type": "boolean"
80+
},
81+
"degenerate_triangles": {
82+
"default": true,
83+
"type": "boolean"
84+
},
85+
"flipped_normals": {
86+
"default": true,
87+
"type": "boolean"
88+
},
89+
"index_buffer": {
90+
"default": true,
91+
"type": "boolean"
92+
},
93+
"material_refs": {
94+
"default": true,
95+
"type": "boolean"
96+
},
97+
"non_manifold_edges": {
98+
"default": true,
99+
"type": "boolean"
100+
},
101+
"normal_mismatch": {
102+
"default": true,
103+
"type": "boolean"
104+
},
105+
"triangle_budget": {
106+
"default": true,
107+
"type": "boolean"
108+
},
109+
"uv_presence": {
110+
"default": true,
111+
"type": "boolean"
112+
}
113+
},
114+
"type": "object"
115+
},
116+
"ValidationThresholds": {
117+
"additionalProperties": false,
118+
"properties": {
119+
"flipped_normal_dot": {
120+
"default": -0.5,
121+
"type": "number"
122+
},
123+
"triangle_budget_tolerance_percent": {
124+
"default": 20.0,
125+
"type": "number"
126+
}
127+
},
128+
"type": "object"
129+
}
130+
},
131+
"properties": {
132+
"budgets": {
133+
"allOf": [
134+
{
135+
"$ref": "#/definitions/Budgets"
136+
}
137+
],
138+
"default": {
139+
"default": 30000,
140+
"environment": 50000,
141+
"hero": 100000,
142+
"prop": 20000
143+
}
144+
},
145+
"filenames": {
146+
"allOf": [
147+
{
148+
"$ref": "#/definitions/FilenameClassifier"
149+
}
150+
],
151+
"default": {
152+
"rules": []
153+
}
154+
},
155+
"format_version": {
156+
"default": 1,
157+
"minimum": 0.0,
158+
"type": "integer"
159+
},
160+
"review": {
161+
"allOf": [
162+
{
163+
"$ref": "#/definitions/ReviewSettings"
164+
}
165+
],
166+
"default": {
167+
"sidecar_dir": null
168+
}
169+
},
170+
"thresholds": {
171+
"allOf": [
172+
{
173+
"$ref": "#/definitions/ValidationThresholds"
174+
}
175+
],
176+
"default": {
177+
"flipped_normal_dot": -0.5,
178+
"triangle_budget_tolerance_percent": 20.0
179+
}
180+
},
181+
"validation": {
182+
"allOf": [
183+
{
184+
"$ref": "#/definitions/ValidationConfig"
185+
}
186+
],
187+
"default": {
188+
"allow_open_mesh": false,
189+
"degenerate_triangles": true,
190+
"flipped_normals": true,
191+
"index_buffer": true,
192+
"material_refs": true,
193+
"non_manifold_edges": true,
194+
"normal_mismatch": true,
195+
"triangle_budget": true,
196+
"uv_presence": true
197+
}
198+
}
199+
},
200+
"title": "ProjectConfig",
201+
"type": "object"
202+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#:schema ../../schemas/json/solarxy-config.json
2+
# Solarxy project configuration
3+
# Generated by `cargo run -p solarxy-core --example gen_default_config`.
4+
# Edit in place — every field has a sensible default, so deleting a key
5+
# falls back to the value below.
6+
#
7+
# Schema reference (enables IDE autocomplete in VS Code, JetBrains, etc.):
8+
#:schema https://raw.githubusercontent.com/marko-koljancic/solarxy/main/schemas/solarxy-config.v1.json
9+
10+
# Solarxy bumps this number when the schema is incompatibly extended.
11+
# Newer configs still load on older Solarxy with a warning.
12+
13+
format_version = 1
14+
15+
[budgets]
16+
hero = 100000
17+
prop = 20000
18+
environment = 50000
19+
default = 30000
20+
21+
[validation]
22+
normal_mismatch = true
23+
flipped_normals = true
24+
non_manifold_edges = true
25+
triangle_budget = true
26+
allow_open_mesh = false
27+
degenerate_triangles = true
28+
material_refs = true
29+
uv_presence = true
30+
index_buffer = true
31+
32+
[thresholds]
33+
triangle_budget_tolerance_percent = 20.0
34+
flipped_normal_dot = -0.5
35+
36+
[filenames]
37+
rules = []
38+
39+
# [[filenames.rules]]
40+
# pattern = "^hero_" # any model whose filename starts with hero_
41+
# category = "hero" # gets the Hero triangle budget
42+
43+
# [[filenames.rules]]
44+
# pattern = "^env_"
45+
# category = "environment"

0 commit comments

Comments
 (0)