From 8bef6d2640aad91ed2daa97b53f277f0515cf100 Mon Sep 17 00:00:00 2001 From: diyajoy Date: Tue, 3 Oct 2023 12:19:21 -0700 Subject: [PATCH] Make "kind" a disallowed field for metadata in schemas. (Internal change: 2297901) --- pxr/usd/usd/schemaRegistry.cpp | 4 +++ .../testUsdSchemaGen/schemaFail23.usda | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 pxr/usd/usd/testenv/testUsdSchemaGen/schemaFail23.usda diff --git a/pxr/usd/usd/schemaRegistry.cpp b/pxr/usd/usd/schemaRegistry.cpp index f00bf02461..9ee1af195c 100644 --- a/pxr/usd/usd/schemaRegistry.cpp +++ b/pxr/usd/usd/schemaRegistry.cpp @@ -1634,6 +1634,10 @@ UsdSchemaRegistry::IsDisallowedField(const TfToken &fieldName) const std::vector clipFields = UsdGetClipRelatedFields(); disallowedFields->insert(clipFields.begin(), clipFields.end()); + // Disallow fallback values for prim "kind" metadata as prim composition + // currently intentionally ignores the "kind" fallback value + disallowedFields->insert(SdfFieldKeys->Kind); + return disallowedFields; }(); diff --git a/pxr/usd/usd/testenv/testUsdSchemaGen/schemaFail23.usda b/pxr/usd/usd/testenv/testUsdSchemaGen/schemaFail23.usda new file mode 100644 index 0000000000..be232f53eb --- /dev/null +++ b/pxr/usd/usd/testenv/testUsdSchemaGen/schemaFail23.usda @@ -0,0 +1,26 @@ +#usda 1.0 +( + "This file is a contrived schema file." + subLayers = [ + @baseSchema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdContrived" + string libraryPath = "pxr/usd/usdContrived" + } +) +{ +} + +class "DisallowedFieldKind" ( + inherits = + kind = "component" + customData = { + string className = "DisallowedFieldKind" + } +) +{ +}