@@ -46,8 +46,8 @@ implementation
4646 CastleGLImages, CastleFonts, CastleFontFamily, CastleTransform,
4747 CastleTextureFont_DjvSans_20, CastleTextureFont_DjvSansB_20,
4848 CastleTextureFont_DjvSansO_20, CastleTextureFont_DjvSansBO_20,
49- CastleDialogStates, CastlePhotoService, CastleDownload,
50- X3DNodes,
49+ CastleDialogStates, CastlePhotoService, CastleDownload, CastleFileFilters,
50+ X3DNodes, X3DLoad,
5151 V3DMInfoDlg, V3DMOptions, V3DMOptionsDlg, V3DMViewpointsDlg, V3DMFilesDlg,
5252 V3DMNavToolbar;
5353
@@ -796,7 +796,7 @@ function GetSceneUnpackDir: string;
796796procedure OpenZippedScene (const Url: string);
797797var
798798 ZippedFile, UnpackDir, SceneFile: string;
799- UnpackedFile, UnpackedFilePart, FileExt : string;
799+ UnpackedFile, UnpackedFilePart: string;
800800 UnZipper: TUnZipper;
801801 I: Integer;
802802 Message: string;
@@ -830,18 +830,12 @@ procedure OpenZippedScene(const Url: string);
830830 UnpackedFile := IncludeTrailingPathDelimiter(UnpackDir) + UnpackedFilePart;
831831
832832 // check if is file and is not inside a subdir
833- if FileExists(UnpackedFile) and (ExtractFileDir(UnpackedFilePart) = ' ' ) then
833+ if FileExists(UnpackedFile) and
834+ (ExtractFileDir(UnpackedFilePart) = ' ' ) and
835+ TFileFilterList.Matches(LoadScene_FileFilters, UnpackedFile) then
834836 begin
835- FileExt := LowerCase(ExtractFileExt(UnpackedFile));
836- if (FileExt = ' .wrl' ) or (FileExt = ' .wrz' )
837- or (FileExt = ' .x3d' ) or (FileExt = ' .x3dv' ) or (FileExt = ' .x3dz' ) or (FileExt = ' .x3dvz' )
838- or (FileExt = ' .dae' ) or (FileExt = ' .iv' ) or (FileExt = ' .3ds' )
839- or (FileExt = ' .obj' ) or (FileExt = ' .geo' ) or (FileExt = ' .stl' )
840- or (FileExt = ' .castle-anim-frames' ) then
841- begin
842- SceneFile := UnpackedFile;
843- break;
844- end ;
837+ SceneFile := UnpackedFile;
838+ break;
845839 end ;
846840 end ;
847841
@@ -850,9 +844,8 @@ procedure OpenZippedScene(const Url: string);
850844 OpenScene(SceneFile)
851845 else begin
852846 Message := ' No supported scene file found inside the zip file.' + NL + NL
853- + ' We enable opening scenes from ZIP archives to be able to ship the main geometry file '
854- + ' together with material files and textures inside one file. It is nearly impossible '
855- + ' to pass multiple files at once on mobile platforms.' + NL + NL
847+ + ' We enable opening scenes from ZIP archives to easily ship the main geometry file '
848+ + ' together with material files and textures inside one file.' + NL + NL
856849 + ' Zip contains:' ;
857850 for I := UnZipper.Entries.Count-1 downto 0 do
858851 Message := Message + NL + ' ' + UnZipper.Entries.Entries[I].DiskFileName;
0 commit comments