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

Method getMaterialLibraries

src/Mod/Material/App/MaterialManagerPyImp.cpp:138–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138Py::List MaterialManagerPy::getMaterialLibraries() const
139{
140 auto libraries = getMaterialManagerPtr()->getLibraries();
141 Py::List list;
142
143 for (auto it = libraries->begin(); it != libraries->end(); it++) {
144 auto lib = *it;
145 Py::Tuple libTuple(3);
146 if (lib->isLocal()) {
147 auto materialLibrary =
148 std::dynamic_pointer_cast<Materials::MaterialLibraryLocal>(lib);
149 if (!materialLibrary) {
150 continue;
151 }
152 libTuple.setItem(0, Py::String(materialLibrary->getName().toStdString()));
153 libTuple.setItem(1, Py::String(materialLibrary->getDirectoryPath().toStdString()));
154 libTuple.setItem(2,
155 Py::Bytes(Py::Bytes(materialLibrary->getIcon().data(),
156 materialLibrary->getIcon().size())));
157 }
158 else
159 {
160 libTuple.setItem(0, Py::String());
161 libTuple.setItem(1, Py::String());
162 libTuple.setItem(2, Py::Bytes());
163 }
164
165 list.append(libTuple);
166 }
167
168 return list;
169}
170
171Py::Dict MaterialManagerPy::getMaterials() const
172{

Callers

nothing calls this directly

Calls 11

isLocalMethod · 0.80
toStdStringMethod · 0.80
getDirectoryPathMethod · 0.80
StringClass · 0.50
beginMethod · 0.45
endMethod · 0.45
getNameMethod · 0.45
dataMethod · 0.45
getIconMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected