MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/MaterialX / updateMaterials

Method updateMaterials

source/MaterialXGraphEditor/Graph.cpp:677–717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

675}
676
677void Graph::updateMaterials(mx::InputPtr input /* = nullptr */, mx::ValuePtr value /* = nullptr */)
678{
679 std::string renderablePath;
680 if (_currRenderNode)
681 {
682 if (_currRenderNode->getNode())
683 {
684 renderablePath = _currRenderNode->getNode()->getNamePath();
685 }
686 else if (_currRenderNode->getOutput())
687 {
688 renderablePath = _currRenderNode->getOutput()->getNamePath();
689 }
690 }
691
692 if (renderablePath.empty())
693 {
694 _renderer->updateMaterials(nullptr);
695 }
696 else
697 {
698 if (!input)
699 {
700 mx::ElementPtr elem = nullptr;
701 {
702 elem = _graphDoc->getDescendant(renderablePath);
703 }
704 mx::TypedElementPtr typedElem = elem ? elem->asA<mx::TypedElement>() : nullptr;
705 _renderer->updateMaterials(typedElem);
706 }
707 else
708 {
709 std::string name = input->getNamePath();
710
711 // Note that if there is a topogical change due to
712 // this value change or a transparency change, then
713 // this is not currently caught here.
714 _renderer->getMaterials()[0]->modifyUniform(name, value);
715 }
716 }
717}
718
719void Graph::showPropertyEditorValue(UiNodePtr node, mx::InputPtr input, const mx::UIProperties& uiProperties)
720{

Callers 4

GraphMethod · 0.45
clearGraphMethod · 0.45
loadGraphFromFileMethod · 0.45
drawGraphMethod · 0.45

Calls 7

getNamePathMethod · 0.80
getDescendantMethod · 0.80
getMaterialsMethod · 0.80
getNodeMethod · 0.45
getOutputMethod · 0.45
emptyMethod · 0.45
modifyUniformMethod · 0.45

Tested by

no test coverage detected