Răsfoiți Sursa

USDZLoader: Preserve attribute connections when a direct value follows. (#33581)

Michael Herzog 2 luni în urmă
părinte
comite
2ccd00aec8
1 a modificat fișierele cu 16 adăugiri și 5 ștergeri
  1. 16 5
      examples/jsm/loaders/usd/USDAParser.js

+ 16 - 5
examples/jsm/loaders/usd/USDAParser.js

@@ -675,12 +675,23 @@ class USDAParser {
 					// Parse value based on type
 					const parsedValue = this._parseAttributeValue( valueType, rawValue );
 
-					// Store as attribute spec
+					// Store as attribute spec, preserving any existing fields
+					// (e.g. connectionPaths set by an earlier `.connect` form)
 					const attrPath = path + '.' + attrName;
-					specsByPath[ attrPath ] = {
-						specType: SpecType.Attribute,
-						fields: { default: parsedValue, typeName: valueType }
-					};
+
+					if ( specsByPath[ attrPath ] ) {
+
+						specsByPath[ attrPath ].fields.default = parsedValue;
+						specsByPath[ attrPath ].fields.typeName = valueType;
+
+					} else {
+
+						specsByPath[ attrPath ] = {
+							specType: SpecType.Attribute,
+							fields: { default: parsedValue, typeName: valueType }
+						};
+
+					}
 
 				}
 

粤ICP备19079148号