scene/schema/collection.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-License-Identifier: BSD-3-Clause | ||
| 2 | /// @file collection.h | ||
| 3 | /// @brief Usd's CollectionAPI: named sets of prims, applied once per collection. | ||
| 4 | /// | ||
| 5 | /// References: | ||
| 6 | /// - Pixar, UsdCollectionAPI, https://openusd.org/release/api/class_usd_collection_a_p_i.html | ||
| 7 | #pragma once | ||
| 8 | |||
| 9 | #include "ernie/scene/view.h" | ||
| 10 | |||
| 11 | #include <array> | ||
| 12 | #include <string_view> | ||
| 13 | #include <vector> | ||
| 14 | |||
| 15 | // clang-format off | ||
| 16 | #define ERNIE_COLLECTION_API_ATTRIBUTES(X) \ | ||
| 17 | X(Choice<ExpansionRule>, ExpansionRule, "collection:__INSTANCE_NAME__:expansionRule", \ | ||
| 18 | ExpansionRule::ExpandPrims, \ | ||
| 19 | "explicitOnly: the targets alone; expandPrims: their descendants too; " \ | ||
| 20 | "expandPrimsAndProperties: and their properties.", \ | ||
| 21 | .group = "Collection") \ | ||
| 22 | X(bool, IncludeRoot, "collection:__INSTANCE_NAME__:includeRoot", false, \ | ||
| 23 | "Whether the root prim is a member.", .group = "Collection") \ | ||
| 24 | X(std::vector<Path>, Includes, "collection:__INSTANCE_NAME__:includes", std::vector<Path>{}, \ | ||
| 25 | "The prims, with their descendants per the rule, in the collection.", .group = "Collection") \ | ||
| 26 | X(std::vector<Path>, Excludes, "collection:__INSTANCE_NAME__:excludes", std::vector<Path>{}, \ | ||
| 27 | "The prims, with their descendants, left out.", .group = "Collection") | ||
| 28 | // clang-format on | ||
| 29 | |||
| 30 | namespace ernie { | ||
| 31 | |||
| 32 | enum class ExpansionRule { ExplicitOnly, ExpandPrims, ExpandPrimsAndProperties }; | ||
| 33 | |||
| 34 | template <> struct ChoiceTokens<ExpansionRule> { | ||
| 35 | static constexpr std::array<std::string_view, 3> kTokens{"explicitOnly", "expandPrims", | ||
| 36 | "expandPrimsAndProperties"}; | ||
| 37 | }; | ||
| 38 | |||
| 39 | 24 | ERNIE_API_SCHEMA(CollectionAPI, ERNIE_COLLECTION_API_ATTRIBUTES, | |
| 40 | "A named set of prims, as light linking and material collections use them."); | ||
| 41 | |||
| 42 | } // namespace ernie | ||
| 43 |