Преглед изворни кода

GLTFLoader: Prevents set data uri in texture.name. (#25682)

* GLTFLoader: Prevents set data uri in texture.name.

* cleanup

* fix maybe optional value

* cleanup
sunag пре 2 година
родитељ
комит
114134e195
1 измењених фајлова са 7 додато и 1 уклоњено
  1. 7 1
      examples/jsm/loaders/GLTFLoader.js

+ 7 - 1
examples/jsm/loaders/GLTFLoader.js

@@ -2988,7 +2988,13 @@ class GLTFParser {
 
 			texture.flipY = false;
 
-			texture.name = textureDef.name || sourceDef.name || sourceDef.uri || '';
+			texture.name = textureDef.name || sourceDef.name || '';
+
+			if ( texture.name === '' && typeof sourceDef.uri === 'string' && sourceDef.uri.startsWith( 'data:image/' ) === false ) {
+
+				texture.name = sourceDef.uri;
+
+			}
 
 			const samplers = json.samplers || {};
 			const sampler = samplers[ textureDef.sampler ] || {};