mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0030953: Data Exchange - implement export of mesh data into glTF 2.0 format
Added new class RWGltf_CafWriter for exporting XCAF document into glTF file as well as Draw Harness command WriteGltf. Added auxiliary method OSD_Path::FileNameAndExtension() splitting file name into Name and Extension.
This commit is contained in:
@@ -1675,3 +1675,34 @@ void OSD_Path::FolderAndFileFromPath (const TCollection_AsciiString& theFilePath
|
||||
theFileName.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : FileNameAndExtension
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OSD_Path::FileNameAndExtension (const TCollection_AsciiString& theFilePath,
|
||||
TCollection_AsciiString& theName,
|
||||
TCollection_AsciiString& theExtension)
|
||||
{
|
||||
const Standard_Integer THE_EXT_MAX_LEN = 20; // this method is supposed to be used with normal extension
|
||||
const Standard_Integer aLen = theFilePath.Length();
|
||||
for (Standard_Integer anExtLen = 1; anExtLen < aLen && anExtLen < THE_EXT_MAX_LEN; ++anExtLen)
|
||||
{
|
||||
if (theFilePath.Value (aLen - anExtLen) == '.')
|
||||
{
|
||||
const Standard_Integer aNameUpper = aLen - anExtLen - 1;
|
||||
if (aNameUpper < 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
theName = theFilePath.SubString (1, aNameUpper);
|
||||
theExtension = theFilePath.SubString (aLen - anExtLen + 1, aLen);
|
||||
theExtension.LowerCase();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
theName = theFilePath;
|
||||
theExtension.Clear();
|
||||
}
|
||||
|
@@ -215,6 +215,18 @@ public:
|
||||
TCollection_AsciiString& theFolder,
|
||||
TCollection_AsciiString& theFileName);
|
||||
|
||||
//! Return file extension from the name in lower case.
|
||||
//! Extension is expected to be within 20-symbols length, and determined as file name tail after last dot.
|
||||
//! Example: IN theFilePath ='Image.sbs.JPG'
|
||||
//! OUT theName ='Image.sbs'
|
||||
//! OUT theFileName ='jpg'
|
||||
//! @param theFilePath [in] file path
|
||||
//! @param theName [out] file name without extension
|
||||
//! @param theExtension [out] file extension in lower case and without dot
|
||||
Standard_EXPORT static void FileNameAndExtension (const TCollection_AsciiString& theFilePath,
|
||||
TCollection_AsciiString& theName,
|
||||
TCollection_AsciiString& theExtension);
|
||||
|
||||
//! Detect absolute DOS-path also used in Windows.
|
||||
//! The total path length is limited to 256 characters.
|
||||
//! Sample path:
|
||||
|
Reference in New Issue
Block a user