MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / addMaterial

Method addMaterial

src/Mod/Material/App/MaterialLibrary.cpp:333–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333std::shared_ptr<Material>
334MaterialLibraryLocal::addMaterial(const std::shared_ptr<Material>& material, const QString& path)
335{
336 QString filePath = getRelativePath(path);
337 QFileInfo info(filePath);
338 std::shared_ptr<Material> newMaterial = std::make_shared<Material>(*material);
339 newMaterial->setLibrary(getptr());
340 newMaterial->setDirectory(getLibraryPath(filePath, info.fileName()));
341 newMaterial->setFilename(info.fileName());
342
343 (*_materialPathMap)[filePath] = newMaterial;
344
345 return newMaterial;
346}
347
348std::shared_ptr<Material> MaterialLibraryLocal::getMaterialByPath(const QString& path) const
349{

Callers

nothing calls this directly

Calls 4

getptrFunction · 0.70
setDirectoryMethod · 0.45
fileNameMethod · 0.45
setFilenameMethod · 0.45

Tested by

no test coverage detected