@@ -11,7 +11,6 @@ module.exports = obj23dtiles;
1111obj23dtiles . combine  =  combine ; 
1212
1313function  obj23dtiles ( objPath ,  outputPath ,  options )  { 
14-     console . time ( 'Total' ) ; 
1514
1615    if ( typeof  options . tilesetOptions  ===  'string' )  { 
1716        options . tilesetOptions  =  fsExtra . readJsonSync ( options . tilesetOptions ) ; 
@@ -29,7 +28,7 @@ function obj23dtiles(objPath, outputPath, options) {
2928            options . batchId  =  true ; 
3029            options . b3dm  =  true ; 
3130
32-             obj2Tileset ( objPath ,  outputPath ,  options ) 
31+             return   obj2Tileset ( objPath ,  outputPath ,  options ) 
3332                . then ( function ( result )  { 
3433                    var  b3dm  =  result . b3dm ; 
3534                    var  batchTableJson  =  result . batchTableJson ; 
@@ -49,9 +48,6 @@ function obj23dtiles(objPath, outputPath, options) {
4948                    tasks . push ( fsExtra . writeJson ( tilesetPath ,  tileset ,  { spaces : 2 } ) ) ; 
5049                    return  Promise . all ( tasks ) ; 
5150                } ) 
52-                 . then ( function ( )  { 
53-                     console . timeEnd ( 'Total' ) ; 
54-                 } ) 
5551                . catch ( function ( error )  { 
5652                    console . log ( error . message  ||  error ) ; 
5753                    process . exit ( 1 ) ; 
@@ -64,7 +60,7 @@ function obj23dtiles(objPath, outputPath, options) {
6460                process . exit ( 1 ) ; 
6561            } 
6662
67-             obj2Tileset ( objPath ,  outputPath ,  options ) 
63+             return   obj2Tileset ( objPath ,  outputPath ,  options ) 
6864                . then ( function ( result )  { 
6965                    var  i3dm  =  result . i3dm ; 
7066                    var  batchTableJson  =  result . batchTableJson ; 
@@ -84,9 +80,6 @@ function obj23dtiles(objPath, outputPath, options) {
8480                    tasks . push ( fsExtra . writeJson ( tilesetPath ,  tileset ,  { spaces : 2 } ) ) ; 
8581                    return  Promise . all ( tasks ) ; 
8682                } ) 
87-                 . then ( function ( )  { 
88-                     console . timeEnd ( 'Total' ) ; 
89-                 } ) 
9083                . catch ( function ( error )  { 
9184                    console . log ( error . message  ||  error ) ; 
9285                    process . exit ( 1 ) ; 
@@ -96,7 +89,7 @@ function obj23dtiles(objPath, outputPath, options) {
9689    else  if  ( options  &&  options . b3dm )  { 
9790        options . binary  =  true ; 
9891        options . batchId  =  true ; 
99-         obj2B3dm ( objPath ,  options ) 
92+         return   obj2B3dm ( objPath ,  options ) 
10093            . then ( function ( result ) { 
10194                var  b3dm  =  result . b3dm ; 
10295                var  batchTableJson  =  result . batchTableJson ; 
@@ -109,9 +102,6 @@ function obj23dtiles(objPath, outputPath, options) {
109102                fsExtra . ensureDirSync ( path . dirname ( outputPath ) ) ; 
110103                return  fsExtra . outputFile ( outputPath ,  b3dm ) ; 
111104            } ) 
112-             . then ( function ( )  { 
113-                 console . timeEnd ( 'Total' ) ; 
114-             } ) 
115105            . catch ( function ( error )  { 
116106                console . log ( error . message  ||  error ) ; 
117107                process . exit ( 1 ) ; 
@@ -124,7 +114,7 @@ function obj23dtiles(objPath, outputPath, options) {
124114            console . log ( 'Convert to i3dm need a custom FeatureTable.' ) ; 
125115            process . exit ( 1 ) ; 
126116        } 
127-         obj2I3dm ( objPath ,  options ) 
117+         return   obj2I3dm ( objPath ,  options ) 
128118            . then ( function ( result ) { 
129119                var  i3dm  =  result . i3dm ; 
130120                var  batchTableJson  =  result . batchTableJson ; 
@@ -137,16 +127,13 @@ function obj23dtiles(objPath, outputPath, options) {
137127                fsExtra . ensureDirSync ( path . dirname ( outputPath ) ) ; 
138128                return  fsExtra . outputFile ( outputPath ,  i3dm ) ; 
139129            } ) 
140-             . then ( function ( )  { 
141-                 console . timeEnd ( 'Total' ) ; 
142-             } ) 
143130            . catch ( function ( error )  { 
144131                console . log ( error . message  ||  error ) ; 
145132                process . exit ( 1 ) ; 
146133            } ) ; 
147134    } 
148135    else  { 
149-         obj2gltf ( objPath ,  options ) 
136+         return   obj2gltf ( objPath ,  options ) 
150137            . then ( function ( result ) { 
151138                var  gltf  =  result . gltf ; 
152139                if  ( options  &&  options . binary )  { 
@@ -158,9 +145,6 @@ function obj23dtiles(objPath, outputPath, options) {
158145                } ; 
159146                return  fsExtra . outputJson ( outputPath ,  gltf ,  jsonOptions ) ; 
160147            } ) 
161-             . then ( function ( )  { 
162-                 console . timeEnd ( 'Total' ) ; 
163-             } ) 
164148            . catch ( function ( error )  { 
165149                console . log ( error . message  ||  error ) ; 
166150                process . exit ( 1 ) ; 
0 commit comments