Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add displayName Metadata to Prim Spec #2055

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pxr/usd/sdf/schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,8 @@ SdfSchemaBase::_RegisterStandardFields()
SdfMetadataDisplayGroupTokens->core)
.MetadataField(SdfFieldKeys->DisplayGroupOrder,
SdfMetadataDisplayGroupTokens->core)
.MetadataField(SdfFieldKeys->DisplayName,
erslavin marked this conversation as resolved.
Show resolved Hide resolved
SdfMetadataDisplayGroupTokens->core)
.MetadataField(SdfFieldKeys->Documentation,
SdfMetadataDisplayGroupTokens->core)
.MetadataField(SdfFieldKeys->Hidden,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

class MfScope "Rig"
{
def MfScope "Leg"
def MfScope "Leg" (
displayName = "Foo"
)
{
custom double kneeFB (
displayName = "LkneeFB"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

class MfScope "Rig"
{
def MfScope "Leg"
def MfScope "Leg" (
displayName = "Foo"
)
{
custom rel foo = </Rig/Leg.kneeFB> (
displayName = "Lfoo"
Expand Down
1 change: 1 addition & 0 deletions pxr/usd/usd/testenv/testUsdMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ int main() {
_VerifyMetadata(prim, true, SdfFieldKeys->Active);
_VerifyMetadata(prim, true, SdfFieldKeys->Hidden);
_VerifyMetadata(prim, TfToken("DummyType"), SdfFieldKeys->TypeName);
_VerifyMetadata(prim, string("Display Name"), SdfFieldKeys->DisplayName);

// attribute metadata
_VerifyMetadata(attr, string("hello"), SdfFieldKeys->Comment);
Expand Down
7 changes: 7 additions & 0 deletions pxr/usd/usd/testenv/testUsdMetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ def test_DisplayName(self):
attr = foo.CreateAttribute("attr", Sdf.ValueTypeNames.String)
rel = foo.CreateRelationship("rel")

# verify display name metadata on prim
self.assertEqual(foo.GetMetadata("displayName"), None)
self.assertEqual(foo.HasAuthoredMetadata("displayName"), False)
self.assertEqual(foo.SetMetadata("displayName", "foo"), True)
self.assertEqual(foo.GetMetadata("displayName"), "foo")
self.assertEqual(foo.HasAuthoredMetadata("displayName"), True)

spiffmon marked this conversation as resolved.
Show resolved Hide resolved
for prop in [attr, rel]:
self.assertEqual(prop.GetDisplayName(), "")
self.assertFalse(prop.HasAuthoredDisplayName())
Expand Down
4 changes: 3 additions & 1 deletion pxr/usd/usd/testenv/testUsdSchemaRegistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ def test_PrimMetadata(self):
self.assertTrue(primDef)

self.assertEqual(set(primDef.ListMetadataFields()),
set(["typeName", "testCustomMetadata", "hidden", "documentation"]))
set(["typeName", "testCustomMetadata", "hidden", "documentation", "displayName"]))
self.assertEqual(primDef.GetMetadata("typeName"), "MetadataTest")
self.assertEqual(primDef.GetMetadata("displayName"), "Display Name")
self.assertEqual(primDef.GetMetadata("documentation"),
"Testing documentation metadata")
self.assertEqual(primDef.GetMetadata("hidden"), True)
Expand Down Expand Up @@ -419,6 +420,7 @@ def _VerifyExpectedPrimData(layer, path, expectedPrimFields,
# Expected fields and properties from the concrete schema.
concretePrimDefPrimFields = {
"apiSchemas" : Sdf.TokenListOp.CreateExplicit([]),
"displayName": "Display Name",
"documentation" : concretePrimDef.GetDocumentation(),
"hidden" : True,
"testCustomMetadata" : "garply",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class "AbstractTest" (
}

class MetadataTest "MetadataTest" (
displayName = "Display Name"
doc = "Testing documentation metadata"
hidden = true
testCustomMetadata = "garply"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class "AbstractTest" (

class MetadataTest "MetadataTest" (
inherits = </AbstractTest>
displayName = "Display Name"
spiffmon marked this conversation as resolved.
Show resolved Hide resolved
doc = "Testing documentation metadata"
hidden = true
testCustomMetadata = "garply"
Expand Down