diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js index 9227a8f27862392fd757c75e7a89b7119859c316..6878e9bd62a1f9ad351f6dc33d99e4bc2cbeebe9 100644 --- a/examples/js/loaders/GLTFLoader.js +++ b/examples/js/loaders/GLTFLoader.js @@ -1153,7 +1153,8 @@ THREE.GLTFLoader = ( function () { var group = new THREE.Object3D(); group.name = mesh.name; - group.userData = mesh.extras || {}; + + if ( mesh.extras ) group.userData = mesh.extras; var primitives = mesh.primitives; @@ -1226,7 +1227,8 @@ THREE.GLTFLoader = ( function () { var meshNode = new THREE.Mesh( geometry, material ); meshNode.castShadow = true; - meshNode.userData = primitive.extras || {}; + + if ( primitive.extras ) meshNode.userData = primitive.extras; group.add( meshNode ); @@ -1268,7 +1270,8 @@ THREE.GLTFLoader = ( function () { var _camera = new THREE.PerspectiveCamera( THREE.Math.radToDeg( xfov ), aspect_ratio, camera.perspective.znear || 1, camera.perspective.zfar || 2e6 ); _camera.name = camera.name; - _camera.userData = camera.extras || {}; + + if ( camera.extras ) _camera.userData = camera.extras; return _camera; @@ -1276,7 +1279,8 @@ THREE.GLTFLoader = ( function () { var _camera = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, camera.orthographic.znear, camera.orthographic.zfar ); _camera.name = camera.name; - _camera.userData = camera.extras || {}; + + if ( camera.extras ) _camera.userData = camera.extras; return _camera; @@ -1393,7 +1397,8 @@ THREE.GLTFLoader = ( function () { } _node.name = node.name; - _node.userData = node.extras || {}; + + if ( node.extras ) _node.userData = node.extras; _node.matrixAutoUpdate = false; @@ -1674,7 +1679,8 @@ THREE.GLTFLoader = ( function () { var _scene = new THREE.Scene(); _scene.name = scene.name; - _scene.userData = scene.extras || {}; + + if ( scene.extras ) _scene.userData = scene.extras; var nodes = scene.nodes; diff --git a/examples/models/gltf/duck/glTF-MaterialsCommon/duck.gltf b/examples/models/gltf/duck/glTF-MaterialsCommon/duck.gltf index 574535ce010539729268ba9ed418c3d6121d2049..ba8d60735c27b1253206bd62506beb771d4f3dcb 100644 --- a/examples/models/gltf/duck/glTF-MaterialsCommon/duck.gltf +++ b/examples/models/gltf/duck/glTF-MaterialsCommon/duck.gltf @@ -177,15 +177,9 @@ }, "indices": "accessor_21", "material": "blinn3-fx", - "mode": 4, - "extras": { - "foo": "primitive" - } + "mode": 4 } - ], - "extras": { - "foo": "mesh" - } + ] } }, "nodes": { @@ -212,10 +206,7 @@ "meshes": [ "LOD3spShape-lib" ], - "name": "LOD3sp", - "extras": { - "foo": "node" - } + "name": "LOD3sp" }, "camera1": { "camera": "cameraShape1", @@ -238,10 +229,7 @@ -4.31078, 1 ], - "name": "camera1", - "extras": { - "foo": "camera" - } + "name": "camera1" }, "directionalLight1": { "children": [], @@ -268,10 +256,7 @@ -2.92179, 1 ], - "name": "directionalLight1", - "extras": { - "foo": "light" - } + "name": "directionalLight1" } }, "samplers": { @@ -289,10 +274,7 @@ "LOD3sp", "camera1", "directionalLight1" - ], - "extras": { - "foo": "scene" - } + ] } }, "skins": {}, diff --git a/examples/models/gltf/duck/glTF/duck.gltf b/examples/models/gltf/duck/glTF/duck.gltf index 1cb3b8467568eea474c7dd307a2e145f351102fd..575a995c1f9121dd4dfbaf53c1b5d3ea85e2018f 100644 --- a/examples/models/gltf/duck/glTF/duck.gltf +++ b/examples/models/gltf/duck/glTF/duck.gltf @@ -150,15 +150,9 @@ }, "indices": "accessor_21", "material": "blinn3-fx", - "mode": 4, - "extras": { - "foo": "primitive" - } + "mode": 4 } - ], - "extras": { - "foo": "mesh" - } + ] } }, "nodes": { @@ -185,10 +179,7 @@ "meshes": [ "LOD3spShape-lib" ], - "name": "LOD3sp", - "extras": { - "foo": "node" - } + "name": "LOD3sp" }, "camera1": { "camera": "cameraShape1", @@ -211,10 +202,7 @@ -4.31078, 1 ], - "name": "camera1", - "extras": { - "foo": "camera" - } + "name": "camera1" }, "directionalLight1": { "children": [], @@ -236,10 +224,7 @@ -2.92179, 1 ], - "name": "directionalLight1", - "extras": { - "foo": "light" - } + "name": "directionalLight1" } }, "programs": { @@ -268,10 +253,7 @@ "LOD3sp", "camera1", "directionalLight1" - ], - "extras": { - "foo": "scene" - } + ] } }, "shaders": {