Skip to content

Commit a8dffbd

Browse files
Updating usability for Graph Editor Add Node (#1387)
Updating the add node popup to clear the input after it is closed and allow for spaces to be used instead of "_" when search for nodes.
1 parent 9aa9b3a commit a8dffbd

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

source/MaterialXGraphEditor/Graph.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2487,6 +2487,10 @@ void Graph::AddLink(ed::PinId inputPinId, ed::PinId outputPinId)
24872487
{
24882488
pin->_input->setConnectedOutput(_graphNodes[upNode]->getOutput());
24892489
}
2490+
else if (_graphNodes[upNode]->getInput() != nullptr)
2491+
{
2492+
pin->_input->setInterfaceName(_graphNodes[upNode]->getName());
2493+
}
24902494
else
24912495
{
24922496
// node graph
@@ -3405,6 +3409,7 @@ void Graph::showHelp() const
34053409
void Graph::addNodePopup(bool cursor)
34063410
{
34073411
bool open_AddPopup = ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && ImGui::IsKeyReleased(ImGuiKey_Tab);
3412+
static char input[32]{ "" };
34083413
if (open_AddPopup)
34093414
{
34103415
cursor = true;
@@ -3414,7 +3419,6 @@ void Graph::addNodePopup(bool cursor)
34143419
{
34153420
ImGui::Text("Add Node");
34163421
ImGui::Separator();
3417-
static char input[32]{ "" };
34183422
if (cursor)
34193423
{
34203424
ImGui::SetKeyboardFocusHere();
@@ -3433,6 +3437,9 @@ void Graph::addNodePopup(bool cursor)
34333437
{
34343438
std::string str(it->second[i][0]);
34353439
std::string nodeName = it->second[i][0];
3440+
//allow spaces to be used to search for node names
3441+
std::replace(subs.begin(), subs.end(), ' ', '_');
3442+
34363443
if (str.find(subs) != std::string::npos)
34373444
{
34383445
if (ImGui::MenuItem(getNodeDefId(nodeName).c_str()) || (ImGui::IsItemFocused() && ImGui::IsKeyPressedMap(ImGuiKey_Enter)))

0 commit comments

Comments
 (0)