@@ -8,6 +8,7 @@ import generateUvs from '../../../utils/data3d/buffer/get-uvs'
8
8
import cloneDeep from 'lodash/cloneDeep'
9
9
import getClosetData3d from '../../../scene/structure/parametric-objects/closet'
10
10
import dataToMaterials from './common/data-to-materials'
11
+ import removeEmptyMeshes from './common/remove-empty-meshes'
11
12
12
13
export default {
13
14
@@ -17,7 +18,7 @@ export default {
17
18
18
19
updateSchema : updateSchema ,
19
20
20
- update : function ( oldData ) {
21
+ update : async function ( oldData ) {
21
22
var this_ = this
22
23
var data = this_ . data
23
24
// remove old mesh
@@ -28,19 +29,18 @@ export default {
28
29
29
30
attributes . materials = dataToMaterials ( data )
30
31
31
- getClosetData3d ( attributes )
32
- . then ( data3d => {
32
+ let data3d = await getClosetData3d ( attributes )
33
+ removeEmptyMeshes ( data3d . meshes )
33
34
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 } )
37
38
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' ) ;
44
44
} ,
45
45
46
46
remove : function ( ) {
0 commit comments