@@ -266,7 +266,7 @@ useExtensionService().registerExtension({
266266 LOAD_3D_ANIMATION ( node ) {
267267 const fileInput = document . createElement ( 'input' )
268268 fileInput . type = 'file'
269- fileInput . accept = '.fbx, glb,gltf '
269+ fileInput . accept = '.gltf,. glb,.fbx '
270270 fileInput . style . display = 'none'
271271 fileInput . onchange = async ( ) => {
272272 if ( fileInput . files ?. length ) {
@@ -452,31 +452,43 @@ useExtensionService().registerExtension({
452452
453453 const onExecuted = node . onExecuted
454454
455- node . onExecuted = function ( message : any ) {
456- onExecuted ?. apply ( this , arguments as any )
455+ useLoad3dService ( ) . waitForLoad3d ( node , ( load3d ) => {
456+ const config = new Load3DConfiguration ( load3d )
457457
458- let filePath = message . result [ 0 ]
458+ const modelWidget = node . widgets ?. find ( ( w ) => w . name === 'model_file' )
459459
460- if ( ! filePath ) {
461- const msg = t ( 'toastMessages.unableToGetModelFilePath' )
462- console . error ( msg )
463- useToastStore ( ) . addAlert ( msg )
464- }
460+ if ( modelWidget ) {
461+ const lastTimeModelFile = node . properties [ 'Last Time Model File' ]
462+
463+ if ( lastTimeModelFile ) {
464+ modelWidget . value = lastTimeModelFile
465+
466+ const cameraState = node . properties [ 'Camera Info' ]
467+
468+ config . configure ( 'output' , modelWidget , cameraState )
469+ }
470+
471+ node . onExecuted = function ( message : any ) {
472+ onExecuted ?. apply ( this , arguments as any )
465473
466- let cameraState = message . result [ 1 ]
474+ let filePath = message . result [ 0 ]
475+
476+ if ( ! filePath ) {
477+ const msg = t ( 'toastMessages.unableToGetModelFilePath' )
478+ console . error ( msg )
479+ useToastStore ( ) . addAlert ( msg )
480+ }
467481
468- useLoad3dService ( ) . waitForLoad3d ( node , ( load3d ) => {
469- const modelWidget = node . widgets ?. find ( ( w ) => w . name === 'model_file' )
482+ let cameraState = message . result [ 1 ]
470483
471- if ( modelWidget ) {
472484 modelWidget . value = filePath . replaceAll ( '\\' , '/' )
473485
474- const config = new Load3DConfiguration ( load3d )
486+ node . properties [ 'Last Time Model File' ] = modelWidget . value
475487
476488 config . configure ( 'output' , modelWidget , cameraState )
477489 }
478- } )
479- }
490+ }
491+ } )
480492 }
481493} )
482494
@@ -526,29 +538,42 @@ useExtensionService().registerExtension({
526538
527539 const onExecuted = node . onExecuted
528540
529- node . onExecuted = function ( message : any ) {
530- onExecuted ?. apply ( this , arguments as any )
541+ useLoad3dService ( ) . waitForLoad3d ( node , ( load3d ) => {
542+ const config = new Load3DConfiguration ( load3d )
543+
544+ const modelWidget = node . widgets ?. find ( ( w ) => w . name === 'model_file' )
531545
532- let filePath = message . result [ 0 ]
546+ if ( modelWidget ) {
547+ const lastTimeModelFile = node . properties [ 'Last Time Model File' ]
533548
534- if ( ! filePath ) {
535- const msg = t ( 'toastMessages.unableToGetModelFilePath' )
536- console . error ( msg )
537- useToastStore ( ) . addAlert ( msg )
538- }
549+ if ( lastTimeModelFile ) {
550+ modelWidget . value = lastTimeModelFile
551+
552+ const cameraState = node . properties [ 'Camera Info' ]
553+
554+ config . configure ( 'output' , modelWidget , cameraState )
555+ }
539556
540- let cameraState = message . result [ 1 ]
557+ node . onExecuted = function ( message : any ) {
558+ onExecuted ?. apply ( this , arguments as any )
559+
560+ let filePath = message . result [ 0 ]
561+
562+ if ( ! filePath ) {
563+ const msg = t ( 'toastMessages.unableToGetModelFilePath' )
564+ console . error ( msg )
565+ useToastStore ( ) . addAlert ( msg )
566+ }
567+
568+ let cameraState = message . result [ 1 ]
541569
542- useLoad3dService ( ) . waitForLoad3d ( node , ( load3d ) => {
543- const modelWidget = node . widgets ?. find ( ( w ) => w . name === 'model_file' )
544- if ( modelWidget ) {
545570 modelWidget . value = filePath . replaceAll ( '\\' , '/' )
546571
547- const config = new Load3DConfiguration ( load3d )
572+ node . properties [ 'Last Time Model File' ] = modelWidget . value
548573
549574 config . configure ( 'output' , modelWidget , cameraState )
550575 }
551- } )
552- }
576+ }
577+ } )
553578 }
554579} )
0 commit comments