Skip to content

Commit 7918f50

Browse files
blevinpixar-oss
authored andcommitted
[sdf] SdfPrimSpec::New() no longer substitutes __AnyType__
for an empty typename. __AnyType__ was a workaround for the early file parser's inability to allow empty typenames in defs, circa 2010. Empty typenames in defs have been well-supported since 2013, so we no longer need to do this, and by omitting it we save a little bit of extra noise in files. Note that __AnyType__ continues to be allowed and supported; we simply no longer insert that in place of an empty typename. The typical scenario where a typeless def occurs is when the typename is provided across a reference arc. (Internal change: 2384346)
1 parent 6be1d6e commit 7918f50

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

pxr/usd/sdf/primSpec.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,26 +94,21 @@ SdfPrimSpec::_New(const SdfPrimSpecHandle &parentPrim,
9494
// Group all the edits in a single change block.
9595
SdfChangeBlock block;
9696

97-
// Use the special "pass" token if the caller tried to
98-
// create a typeless def
99-
TfToken type = (typeName.IsEmpty() && spec == SdfSpecifierDef)
100-
? SdfTokens->AnyTypeToken : typeName;
101-
10297
SdfLayerHandle layer = parentPrimPtr->GetLayer();
10398
SdfPath childPath = parentPrimPtr->GetPath().AppendChild(name);
10499

105100
// PrimSpecs are considered inert if their specifier is
106-
// "over" and the type is not specified.
107-
bool inert = (spec == SdfSpecifierOver) && type.IsEmpty();
101+
// "over" and the typeName is not specified.
102+
bool inert = (spec == SdfSpecifierOver) && typeName.IsEmpty();
108103

109104
if (!Sdf_ChildrenUtils<Sdf_PrimChildPolicy>::CreateSpec(
110105
layer, childPath, SdfSpecTypePrim, inert)) {
111106
return TfNullPtr;
112107
}
113108

114109
layer->SetField(childPath, SdfFieldKeys->Specifier, spec);
115-
if (!type.IsEmpty()) {
116-
layer->SetField(childPath, SdfFieldKeys->TypeName, type);
110+
if (!typeName.IsEmpty()) {
111+
layer->SetField(childPath, SdfFieldKeys->TypeName, typeName);
117112
}
118113

119114
return layer->GetPrimAtPath(childPath);

0 commit comments

Comments
 (0)