| 367 | } |
| 368 | |
| 369 | Py::Dict MaterialPy::getProperties() const |
| 370 | { |
| 371 | Py::Dict dict; |
| 372 | |
| 373 | // Maintain backwards compatibility |
| 374 | dict.setItem(Py::String("CardName"), Py::String(getMaterialPtr()->getName().toStdString())); |
| 375 | dict.setItem(Py::String("AuthorAndLicense"), |
| 376 | Py::String(getMaterialPtr()->getAuthorAndLicense().toStdString())); |
| 377 | dict.setItem(Py::String("Author"), Py::String(getMaterialPtr()->getAuthor().toStdString())); |
| 378 | dict.setItem(Py::String("License"), Py::String(getMaterialPtr()->getLicense().toStdString())); |
| 379 | dict.setItem(Py::String("Name"), Py::String(getMaterialPtr()->getName().toStdString())); |
| 380 | dict.setItem(Py::String("Description"), |
| 381 | Py::String(getMaterialPtr()->getDescription().toStdString())); |
| 382 | dict.setItem(Py::String("ReferenceSource"), |
| 383 | Py::String(getMaterialPtr()->getReference().toStdString())); |
| 384 | dict.setItem(Py::String("SourceURL"), Py::String(getMaterialPtr()->getURL().toStdString())); |
| 385 | |
| 386 | auto properties = getMaterialPtr()->getPhysicalProperties(); |
| 387 | for (auto& it : properties) { |
| 388 | QString key = it.first; |
| 389 | auto materialProperty = it.second; |
| 390 | |
| 391 | if (!materialProperty->isNull()) { |
| 392 | auto value = materialProperty->getDictionaryString(); |
| 393 | dict.setItem(Py::String(key.toStdString()), Py::String(value.toStdString())); |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | properties = getMaterialPtr()->getAppearanceProperties(); |
| 398 | for (auto& it : properties) { |
| 399 | QString key = it.first; |
| 400 | auto materialProperty = it.second; |
| 401 | |
| 402 | if (!materialProperty->isNull()) { |
| 403 | auto value = materialProperty->getDictionaryString(); |
| 404 | dict.setItem(Py::String(key.toStdString()), Py::String(value.toStdString())); |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | auto legacy = getMaterialPtr()->getLegacyProperties(); |
| 409 | for (auto& it : legacy) { |
| 410 | auto key = it.first; |
| 411 | auto value = it.second; |
| 412 | |
| 413 | if (!value.isEmpty()) { |
| 414 | dict.setItem(Py::String(key.toStdString()), Py::String(value.toStdString())); |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | return dict; |
| 419 | } |
| 420 | |
| 421 | Py::Dict MaterialPy::getPhysicalProperties() const |
| 422 | { |
no test coverage detected