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

Method getAppearanceValue

src/Mod/Material/App/MaterialPyImp.cpp:518–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

516}
517
518PyObject* MaterialPy::getAppearanceValue(PyObject* args)
519{
520 char* name;
521 if (!PyArg_ParseTuple(args, "s", &name)) {
522 return nullptr;
523 }
524
525 if (!getMaterialPtr()->hasAppearanceProperty(QString::fromStdString(name))) {
526 Py_RETURN_NONE;
527 }
528
529 auto property = getMaterialPtr()->getAppearanceProperty(QString::fromStdString(name));
530 if (!property) {
531 Py_RETURN_NONE;
532 }
533
534 if (property->getType() == MaterialValue::Array2D) {
535 auto value =
536 std::static_pointer_cast<Materials::Array2D>(property->getMaterialValue());
537 return new Array2DPy(new Array2D(*value));
538 }
539 if (property->getType() == MaterialValue::Array3D) {
540 auto value =
541 std::static_pointer_cast<Materials::Array3D>(property->getMaterialValue());
542 return new Array3DPy(new Array3D(*value));
543 }
544
545 QVariant value = property->getValue();
546 return _pyObjectFromVariant(value);
547}
548
549PyObject* MaterialPy::setAppearanceValue(PyObject* args)
550{

Callers

nothing calls this directly

Calls 5

getAppearancePropertyMethod · 0.80
getMaterialValueMethod · 0.80
hasAppearancePropertyMethod · 0.45
getTypeMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected