MaterialX 1.39.1
Loading...
Searching...
No Matches
Util.h
Go to the documentation of this file.
1//
2// Copyright Contributors to the MaterialX Project
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#ifndef MATERIALX_FORMAT_UTIL_H
7#define MATERIALX_FORMAT_UTIL_H
8
11
15
19
20MATERIALX_NAMESPACE_BEGIN
21
24MX_FORMAT_API string readFile(const FilePath& file);
25
27MX_FORMAT_API void getSubdirectories(const FilePathVec& rootDirectories, const FileSearchPath& searchPath, FilePathVec& subDirectories);
28
30MX_FORMAT_API void loadDocuments(const FilePath& rootPath,
31 const FileSearchPath& searchPath,
32 const StringSet& skipFiles,
33 const StringSet& includeFiles,
34 vector<DocumentPtr>& documents,
35 StringVec& documentsPaths,
36 const XmlReadOptions* readOptions = nullptr,
37 StringVec* errors = nullptr);
38
40MX_FORMAT_API void loadLibrary(const FilePath& file,
41 DocumentPtr doc,
42 const FileSearchPath& searchPath = FileSearchPath(),
43 const XmlReadOptions* readOptions = nullptr);
44
47MX_FORMAT_API StringSet loadLibraries(const FilePathVec& libraryFolders,
48 const FileSearchPath& searchPath,
49 DocumentPtr doc,
50 const StringSet& excludeFiles = StringSet(),
51 const XmlReadOptions* readOptions = nullptr);
52
58MX_FORMAT_API void flattenFilenames(DocumentPtr doc, const FileSearchPath& searchPath = FileSearchPath(), StringResolverPtr customResolver = nullptr);
59
62
67
68MATERIALX_NAMESPACE_END
69
70#endif
The top-level Document class.
shared_ptr< const Document > ConstDocumentPtr
A shared pointer to a const Document.
Definition: Document.h:24
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
Definition: Document.h:22
Base and generic element classes.
shared_ptr< StringResolver > StringResolverPtr
A shared pointer to a StringResolver.
Definition: Element.h:66
Cross-platform support for file and search paths.
Interface element subclasses.
std::set< string > StringSet
A set of strings.
Definition: Library.h:59
vector< string > StringVec
A vector of strings.
Definition: Library.h:55
Macros for declaring imported and exported symbols.
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 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 pat...
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 a...
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.
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 FileSearchPath getDefaultDataSearchPath()
Return a file search path to the default data library folder.
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,...
MX_FORMAT_API FileSearchPath getSourceSearchPath(ConstDocumentPtr doc)
Return a file search path containing the parent folder of each source URI in the given document.
Support for the MTLX file format.
A generic file path, supporting both syntactic and file system operations.
Definition: File.h:27
A sequence of file paths, which may be queried to find the first instance of a given filename on the ...
Definition: File.h:219
A set of options for controlling the behavior of XML read functions.
Definition: XmlIo.h:32