Skip to content

Commit

Permalink
Guard against unnecessary array detaches in attribute creation
Browse files Browse the repository at this point in the history
  • Loading branch information
nvmkuruc committed Nov 15, 2023
1 parent dcbc1ca commit 47b847a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pxr/usd/usd/schemaRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ BuildPrimDefinition(_SchemaDefInitHelper *defInitHelper)

// Get the list of names of any override properties this schema may have as
// we want to skip these at first when initializing the prim definition.
VtTokenArray overridePropertyNames = _GetOverridePropertyNames(
const VtTokenArray overridePropertyNames = _GetOverridePropertyNames(
schematicsLayer, schematicsPrimPath);

// Multiple apply schemas are actually templates for creating an instance of
Expand Down Expand Up @@ -1455,7 +1455,8 @@ BuildPrimDefinition(_SchemaDefInitHelper *defInitHelper)
// With all the built-in API schemas composed in, we can now compose any
// API schema property overrides declared in this API schema over the
// defined properties.
for (const TfToken &overridePropertyName : overridePropertyNames) {
for (const TfToken &overridePropertyName :
overridePropertyNames.AsConst()) {
primDef->_ComposeOverAndReplaceExistingProperty(
overridePropertyName,
schematicsLayer,
Expand Down Expand Up @@ -1535,7 +1536,7 @@ _PopulateConcretePrimDefinitions() const
const SdfPath schematicsPrimPath =
SdfPath::AbsoluteRootPath().AppendChild(schemaInfo->identifier);

VtTokenArray overridePropertyNames = _GetOverridePropertyNames(
const VtTokenArray overridePropertyNames = _GetOverridePropertyNames(
schematicsLayer, schematicsPrimPath);

// Create and initialize a new prim definition for the concrete schema.
Expand Down Expand Up @@ -1565,7 +1566,8 @@ _PopulateConcretePrimDefinitions() const
// With all the built-in API schemas applied, we can now compose any
// API schema property overrides declared in the typed schema over the
// current defined properties.
for (const TfToken &overridePropertyName : overridePropertyNames) {
for (const TfToken &overridePropertyName :
overridePropertyNames.AsConst()) {
primDef->_ComposeOverAndReplaceExistingProperty(
overridePropertyName,
schematicsLayer,
Expand Down

0 comments on commit 47b847a

Please sign in to comment.