MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/MaterialX / loadDocuments

Function loadDocuments

source/MaterialXFormat/Util.cpp:47–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47void loadDocuments(const FilePath& rootPath, const FileSearchPath& searchPath, const StringSet& skipFiles,
48 const StringSet& includeFiles, vector<DocumentPtr>& documents, StringVec& documentsPaths,
49 const XmlReadOptions* readOptions, StringVec* errors)
50{
51 for (const FilePath& dir : rootPath.getSubDirectories())
52 {
53 for (const FilePath& file : dir.getFilesInDirectory(MTLX_EXTENSION))
54 {
55 if (!skipFiles.count(file) &&
56 (includeFiles.empty() || includeFiles.count(file)))
57 {
58 DocumentPtr doc = createDocument();
59 const FilePath filePath = dir / file;
60 try
61 {
62 FileSearchPath readSearchPath(searchPath);
63 readSearchPath.append(dir);
64 readFromXmlFile(doc, filePath, readSearchPath, readOptions);
65 documents.push_back(doc);
66 documentsPaths.push_back(filePath.asString());
67 }
68 catch (Exception& e)
69 {
70 if (errors)
71 {
72 errors->push_back("Failed to load: " + filePath.asString() + ". Error: " + e.what());
73 }
74 }
75 }
76 }
77 }
78}
79
80void loadLibrary(const FilePath& file, DocumentPtr doc, const FileSearchPath& searchPath, const XmlReadOptions* readOptions)
81{

Callers 2

shaderGenPerformanceTestFunction · 0.85
validateMethod · 0.85

Calls 10

readFromXmlFileFunction · 0.85
getSubDirectoriesMethod · 0.80
getFilesInDirectoryMethod · 0.80
countMethod · 0.80
push_backMethod · 0.80
createDocumentFunction · 0.50
emptyMethod · 0.45
appendMethod · 0.45
asStringMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected