Skip to content

Commit 2ccd00a

Browse files
authored
USDZLoader: Preserve attribute connections when a direct value follows. (mrdoob#33581)
1 parent 75a9790 commit 2ccd00a

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

examples/jsm/loaders/usd/USDAParser.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -675,12 +675,23 @@ class USDAParser {
675675
// Parse value based on type
676676
const parsedValue = this._parseAttributeValue( valueType, rawValue );
677677

678-
// Store as attribute spec
678+
// Store as attribute spec, preserving any existing fields
679+
// (e.g. connectionPaths set by an earlier `.connect` form)
679680
const attrPath = path + '.' + attrName;
680-
specsByPath[ attrPath ] = {
681-
specType: SpecType.Attribute,
682-
fields: { default: parsedValue, typeName: valueType }
683-
};
681+
682+
if ( specsByPath[ attrPath ] ) {
683+
684+
specsByPath[ attrPath ].fields.default = parsedValue;
685+
specsByPath[ attrPath ].fields.typeName = valueType;
686+
687+
} else {
688+
689+
specsByPath[ attrPath ] = {
690+
specType: SpecType.Attribute,
691+
fields: { default: parsedValue, typeName: valueType }
692+
};
693+
694+
}
684695

685696
}
686697

0 commit comments

Comments
 (0)