Gorilla.Sketchfab.Loader
Unit Gorilla.Sketchfab.Loader.pasClasses
- EGorillaSketchfabException = class ( Exception )
- TGorillaLoaderSketchfab = class ( TGorillaLoader )
Constants
- const GORILLA_SKETCHFAB_URL : string = "https://sketchfab.com/";
- const GORILLA_SKETCHFAB_API_URL : string = "https://api.sketchfab.com/v3/";
- const GORILLA_SKETCHFAB_API_MODEL_DOWNLOAD : string = "models/%%s/download";
TGorillaLoaderSketchfab
Loader for downloading Sketchfab models. See for further information: https://sketchfab.com/developers/ The importer automatically includes OBJ, FBX and/or glTF fileformats.
Ancestors
Members
Fields
- protected MESH_COUNTER :
Integer
- protected FClient :
TRESTClient
- protected FLoginAuth :
THTTPBasicAuthenticator
- protected FRequestToken :
TRESTRequest
- protected FResponseToken :
TRESTResponse
- protected FRequestModel :
TRESTRequest
- protected FResponseModel :
TRESTResponse
- protected FAccessToken :
string
- protected FRefreshToken :
string
Methods
- public constructor Create ( ) ;
- public destructor Destroy ( ) ;
- protected function DoGetDestDir
(
ADestDir :
string; AUID :
string
)
: string
;
Returns the destination directory as a concatination of ADestDir and UID. If ADestDir is empty, the method returns a directoy in temp-path.
- protected function DoGetDestFile
(
ADestDir :
string; AMask :
string
)
: string
;
Searches for a specific file in the given destination directory. The sketchfab loader uses extension masks for finding specific files, like ".gltf" or ".zip".
- protected procedure DoLogin
(
const
AURL :
string; const
AUsername :
string; const
APassword :
string; const
AClientId :
string; const
AClientSecret :
string
)
;
Processes the login with sketchfab api. If any error occurs, the method will throw an exception. DoRequestDownloadURL() implicitly calls the login routine.
- protected procedure DoRequestDownloadURL ( const AURL : string; const AUsername : string; const APassword : string; const AClientId : string; const AClientSecret : string; const AUID : string; var ADestDir : string; var ADownloadURL : string ) ;
- protected procedure DoDecomposeDownloadURL
(
const
ADownloadURL :
string; var
AData :
TURI
)
;
Decomposes given URL into all parts. This will be used to setup request correctly, because RESTClient has problems with complex URL as BaseURL value.
- protected function DoDownloadArchive
(
const
ADestDir :
string; const
ADownloadURL :
string
)
: string
;
We receive a zip-archive url from sketchfab to download the model files. The method will download the given url to destination folder and returns the filename for the stored zip-archive.
- protected function DoExtractArchive
(
const
ADestDir :
string; const
AArchive :
string
)
: string
;
After we successfully downloaded the zip-archive, we need to extract it to the given destination directory. The method will automatically search for a *.gltf file and returns it.
- protected function DoCheckIfZIPAlreadyCached
(
ADestDir :
string; AUID :
string; var
AZIPFile :
string
)
: Boolean
;
This method checks a specific directory, based on a destination directory and the model UID, for an existing zip-archive. It will return the complete filename, otherwise the result string will be empty.
- protected function DoCheckIfGLTFAlreadyCached
(
ADestDir :
string; AUID :
string; var
AGLTFFile :
string
)
: Boolean
;
This method checks a specific directory, based on a destination directory and the model UID, for an existing *.gltf model file. It will return the complete filename, otherwise the result string will be empty.
- protected function DoLoadModelDef
(
const
AOptions :
TGorillaLoadOptions
)
: TModelDef
;
The method establishes the complete cache and / or download process.
- public function LoadModelDefFromStream ( const AStream : TStream; const AOptions : TGorillaLoadOptions ) : TModelDef ; overload override;