scene/reference.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-License-Identifier: BSD-3-Clause | ||
| 2 | /// @file reference.h | ||
| 3 | /// @brief Every view of the schema registry, generated from its declarations: the JSON Schema of | ||
| 4 | /// scene files, the reference pages, Ernie's codeless USD schema plugin and scene validation. | ||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "ernie/scene/json.h" | ||
| 8 | #include "ernie/scene/schema.h" | ||
| 9 | |||
| 10 | #include <span> | ||
| 11 | #include <string> | ||
| 12 | #include <string_view> | ||
| 13 | #include <vector> | ||
| 14 | |||
| 15 | namespace ernie { | ||
| 16 | |||
| 17 | /// @return The family of a schema, or null for an unlisted one. | ||
| 18 | const SchemaFamily* FindFamily(std::string_view schema); | ||
| 19 | /// @return Whether a schema is Ernie's own rather than one mirroring USD. | ||
| 20 | bool IsErnieSchema(std::string_view schema); | ||
| 21 | |||
| 22 | /// @return An attribute's USD value type, as `double3`, `token` or `float3[]`. | ||
| 23 | std::string UsdTypeName(const AttributeDef& def); | ||
| 24 | |||
| 25 | /// @return The JSON Schema (draft 2020-12) of scene files: each prim type and API schema with its | ||
| 26 | /// attributes' types, fallbacks, ranges, allowed tokens and descriptions. | ||
| 27 | std::string SceneJsonSchema(); | ||
| 28 | /// @return A family's reference page in Markdown: each schema's description, base and attribute | ||
| 29 | /// table, with an example scene. | ||
| 30 | std::string ReferencePage(const SchemaFamily& family); | ||
| 31 | /// @return A minimal scene file using a prim type or API schema, which loads without problems. | ||
| 32 | std::string ExampleScene(const SchemaDef& schema); | ||
| 33 | |||
| 34 | /// @brief A codeless USD schema plugin: its two files. | ||
| 35 | 2 | struct UsdSchemaPlugin { | |
| 36 | std::string generatedSchema; | ||
| 37 | std::string plugInfo; | ||
| 38 | }; | ||
| 39 | /// @return The plugin declaring Ernie's own schemas to USD, as `usdGenSchema` lays one out. | ||
| 40 | UsdSchemaPlugin ErnieUsdSchemaPlugin(); | ||
| 41 | |||
| 42 | /// @brief Checks a scene file against the registry as loading does, and past what JSON Schema | ||
| 43 | /// can: unknown attributes (with the nearest declared names), wrong types, out-of-range values, | ||
| 44 | /// misapplied API schemas and relationships to prims the file doesn't have. | ||
| 45 | /// @return Every problem; empty for a valid file. | ||
| 46 | std::vector<SceneProblem> ValidateScene(std::string_view json); | ||
| 47 | |||
| 48 | } // namespace ernie | ||
| 49 |