HDK
|
#include <MaterialXCore/Document.h>
#include <MaterialXCore/Element.h>
#include <MaterialXCore/Interface.h>
#include <MaterialXFormat/Export.h>
#include <MaterialXFormat/File.h>
#include <MaterialXFormat/XmlIo.h>
Go to the source code of this file.
Functions | |
MATERIALX_NAMESPACE_BEGIN MX_FORMAT_API string | readFile (const FilePath &file) |
MX_FORMAT_API void | getSubdirectories (const FilePathVec &rootDirectories, const FileSearchPath &searchPath, FilePathVec &subDirectories) |
Get all subdirectories for a given set of directories and search paths. More... | |
MX_FORMAT_API void | loadDocuments (const FilePath &rootPath, const FileSearchPath &searchPath, const StringSet &skipFiles, const StringSet &includeFiles, vector< DocumentPtr > &documents, StringVec &documentsPaths, const XmlReadOptions *readOptions=nullptr, StringVec *errors=nullptr) |
Scans for all documents under a root path and returns documents which can be loaded. More... | |
MX_FORMAT_API void | loadLibrary (const FilePath &file, DocumentPtr doc, const FileSearchPath &searchPath=FileSearchPath(), const XmlReadOptions *readOptions=nullptr) |
Load a given MaterialX library into a document. More... | |
MX_FORMAT_API StringSet | loadLibraries (const FilePathVec &libraryFolders, const FileSearchPath &searchPath, DocumentPtr doc, const StringSet &excludeFiles=StringSet(), const XmlReadOptions *readOptions=nullptr) |
MX_FORMAT_API void | flattenFilenames (DocumentPtr doc, const FileSearchPath &searchPath=FileSearchPath(), StringResolverPtr customResolver=nullptr) |
MX_FORMAT_API FileSearchPath | getSourceSearchPath (ConstDocumentPtr doc) |
Return a file search path containing the parent folder of each source URI in the given document. More... | |
MX_FORMAT_API FileSearchPath | getDefaultDataSearchPath () |
Format utility methods
Definition in file Util.h.
MX_FORMAT_API void flattenFilenames | ( | DocumentPtr | doc, |
const FileSearchPath & | searchPath = FileSearchPath() , |
||
StringResolverPtr | customResolver = nullptr |
||
) |
Flatten all filenames in the given document, applying string resolvers at the scope of each element and removing all fileprefix attributes.
doc | The document to modify. |
searchPath | An optional search path for relative to absolute path conversion. |
customResolver | An optional custom resolver to apply. |
MX_FORMAT_API FileSearchPath getDefaultDataSearchPath | ( | ) |
Return a file search path to the default data library folder. The module path and all parent paths are examined to until either there is no parent or the library folder is found.
MX_FORMAT_API FileSearchPath getSourceSearchPath | ( | ConstDocumentPtr | doc | ) |
Return a file search path containing the parent folder of each source URI in the given document.
MX_FORMAT_API void getSubdirectories | ( | const FilePathVec & | rootDirectories, |
const FileSearchPath & | searchPath, | ||
FilePathVec & | subDirectories | ||
) |
Get all subdirectories for a given set of directories and search paths.
MX_FORMAT_API void loadDocuments | ( | const FilePath & | rootPath, |
const FileSearchPath & | searchPath, | ||
const StringSet & | skipFiles, | ||
const StringSet & | includeFiles, | ||
vector< DocumentPtr > & | documents, | ||
StringVec & | documentsPaths, | ||
const XmlReadOptions * | readOptions = nullptr , |
||
StringVec * | errors = nullptr |
||
) |
Scans for all documents under a root path and returns documents which can be loaded.
MX_FORMAT_API StringSet loadLibraries | ( | const FilePathVec & | libraryFolders, |
const FileSearchPath & | searchPath, | ||
DocumentPtr | doc, | ||
const StringSet & | excludeFiles = StringSet() , |
||
const XmlReadOptions * | readOptions = nullptr |
||
) |
Load all MaterialX files within the given library folders into a document, using the given search path to locate the folders on the file system.
MX_FORMAT_API void loadLibrary | ( | const FilePath & | file, |
DocumentPtr | doc, | ||
const FileSearchPath & | searchPath = FileSearchPath() , |
||
const XmlReadOptions * | readOptions = nullptr |
||
) |
Load a given MaterialX library into a document.
MATERIALX_NAMESPACE_BEGIN MX_FORMAT_API string readFile | ( | const FilePath & | file | ) |
Read the given file and return a string containing its contents; if the read is not successful, then the empty string is returned.