| 675 | } |
| 676 | |
| 677 | void 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 | |
| 719 | void Graph::showPropertyEditorValue(UiNodePtr node, mx::InputPtr input, const mx::UIProperties& uiProperties) |
| 720 | { |
no test coverage detected