@@ -8,6 +8,7 @@ import generateUvs from '../../../utils/data3d/buffer/get-uvs'
88import cloneDeep from 'lodash/cloneDeep'
99import getClosetData3d from '../../../scene/structure/parametric-objects/closet'
1010import dataToMaterials from './common/data-to-materials'
11+ import removeEmptyMeshes from './common/remove-empty-meshes'
1112
1213export default {
1314
@@ -17,7 +18,7 @@ export default {
1718
1819 updateSchema : updateSchema ,
1920
20- update : function ( oldData ) {
21+ update : async function ( oldData ) {
2122 var this_ = this
2223 var data = this_ . data
2324 // remove old mesh
@@ -28,19 +29,18 @@ export default {
2829
2930 attributes . materials = dataToMaterials ( data )
3031
31- getClosetData3d ( attributes )
32- . then ( data3d => {
32+ let data3d = await getClosetData3d ( attributes )
33+ removeEmptyMeshes ( data3d . meshes )
3334
34- // create new one
35- this_ . mesh = new THREE . Object3D ( )
36- this_ . data3dView = new io3d . aFrame . three . Data3dView ( { parent : this_ . mesh } )
35+ // create new one
36+ this_ . mesh = new THREE . Object3D ( )
37+ this_ . data3dView = new io3d . aFrame . three . Data3dView ( { parent : this_ . mesh } )
3738
38- // update view
39- this_ . data3dView . set ( data3d )
40- this_ . el . setObject3D ( 'mesh' , this_ . mesh )
41- // emit event
42- this_ . el . emit ( 'mesh-updated' ) ;
43- } )
39+ // update view
40+ this_ . data3dView . set ( data3d )
41+ this_ . el . setObject3D ( 'mesh' , this_ . mesh )
42+ // emit event
43+ this_ . el . emit ( 'mesh-updated' ) ;
4444 } ,
4545
4646 remove : function ( ) {
0 commit comments