@@ -652,31 +652,39 @@ FocusScope {
652652 property int previousOrientationTag: 1
653653
654654 function getAlbedoFile () {
655+ // get the image file from an external URL
656+ if (useExternal) {
657+ var externalFile = Filepath .urlToString (sourceExternal)
658+ if (externalFile .includes (" _normals" ))
659+ return Filepath .stringToUrl (externalFile .replace (" _normals" , " _albedo" ))
660+ return sourceExternal
661+ }
655662
663+ // get the image file from selected node albedo attribute
656664 if (vp && selectedNode && selectedNode .hasAttribute (" albedo" ))
657665 return Filepath .stringToUrl (Filepath .resolve (selectedNode .attribute (" albedo" ).value , vp))
658666
659- const imageFileUrl = getImageFile ()
660- var imageFile = Filepath .urlToString (imageFileUrl)
661-
662- if (imageFile .includes (" _normals" ))
663- return Filepath .stringToUrl (imageFile .replace (" _normals" , " _albedo" ))
664-
665- return imageFileUrl
667+ // no valid image file, return empty url
668+ return " "
666669 }
667670
668671 function getNormalFile () {
672+ // get the image file from an external URL
673+ if (useExternal) {
674+ var externalFile = Filepath .urlToString (sourceExternal)
675+ if (externalFile .includes (" _normals" ))
676+ return sourceExternal
677+ if (externalFile .includes (" _albedo" ))
678+ return Filepath .stringToUrl (externalFile .replace (" _albedo" , " _normals" ))
679+ return " " // invalid external file
680+ }
669681
682+ // get the image file from selected node normals attribute
670683 if (vp && selectedNode && selectedNode .hasAttribute (" normals" ))
671684 return Filepath .stringToUrl (Filepath .resolve (selectedNode .attribute (" normals" ).value , vp))
672-
673- const imageFileUrl = getImageFile ()
674- var imageFile = Filepath .urlToString (imageFileUrl)
675-
676- if (imageFile .includes (" _albedo" ))
677- return Filepath .stringToUrl (imageFile .replace (" _albedo" , " _normals" ))
678-
679- return imageFileUrl
685+
686+ // no valid image file, return empty url
687+ return " "
680688 }
681689
682690 onWidthChanged: {
0 commit comments