diff --git a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp index 3bb3883a24f9afa003ab97e4c40c3fa33d606821..52e254525baa256345eb6108c8e13003fb605e84 100644 --- a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp +++ b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp @@ -13,12 +13,11 @@ // ************************************************************************************************ #include "GUI/View/SampleDesigner/MaterialInplaceForm.h" -#include "GUI/Model/Session/ModelPath.h" #include "GUI/Model/Material/MaterialItem.h" -#include "GUI/Model/Material/MaterialItemUtils.h" #include "GUI/Model/Material/MaterialModel.h" #include "GUI/Model/Material/MaterialModelStore.h" #include "GUI/Model/Sample/ItemWithMaterial.h" +#include "GUI/Model/Session/ModelPath.h" #include "GUI/Model/State/SessionData.h" #include "GUI/Model/Types/DoubleDescriptor.h" #include "GUI/Model/Types/VectorDescriptor.h" @@ -92,26 +91,25 @@ void MaterialInplaceForm::createWidgets() // -- Create UI for delta/beta resp. sldRe/sldIm DoubleDescriptors values; - auto* materialItem = GUI::MaterialUtil::findMaterial(m_item->materialIdentifier()); - if (materialItem->hasRefractiveIndex()) { - DoubleDescriptor delta = materialItem->delta(); + if (material()->hasRefractiveIndex()) { + DoubleDescriptor delta = material()->delta(); delta.set = [=](double value) { material()->delta().set(value); }; delta.get = [=]() { return material()->delta(); }; delta.path = [=] { return GUI::Model::Path::getPathFromItem(m_item) + "/delta"; }; - DoubleDescriptor beta = materialItem->beta(); + DoubleDescriptor beta = material()->beta(); beta.set = [=](double value) { material()->beta().set(value); }; beta.get = [=]() { return material()->beta(); }; beta.path = [=] { return GUI::Model::Path::getPathFromItem(m_item) + "/beta"; }; values << delta << beta; } else { - DoubleDescriptor re = materialItem->sldRe(); + DoubleDescriptor re = material()->sldRe(); re.set = [=](double value) { material()->sldRe().set(value); }; re.get = [=]() { return material()->sldRe(); }; re.path = [=] { return GUI::Model::Path::getPathFromItem(m_item) + "/re"; }; - DoubleDescriptor im = materialItem->sldIm(); + DoubleDescriptor im = material()->sldIm(); im.set = [=](double value) { material()->sldIm().set(value); }; im.get = [=]() { return material()->sldIm(); }; im.path = [=] { return GUI::Model::Path::getPathFromItem(m_item) + "/im"; }; @@ -133,7 +131,7 @@ void MaterialInplaceForm::createWidgets() } // -- Create UI for magnetization vector - VectorDescriptor mag = materialItem->magnetizationVector(); + VectorDescriptor mag = material()->magnetizationVector(); mag.x.set = [=](double value) { material()->magnetizationVector().x.set(value); }; mag.x.get = [=]() { return material()->magnetizationVector().x; }; mag.x.path = [=] { return GUI::Model::Path::getPathFromItem(m_item) + "/x"; }; @@ -163,7 +161,7 @@ void MaterialInplaceForm::createWidgets() MaterialItem* MaterialInplaceForm::material() { - return GUI::MaterialUtil::findMaterial(m_item->materialIdentifier()); + return m_item->material(); } void MaterialInplaceForm::onMaterialChanged(MaterialItem* materialItem)