pdlogingithub / UE4-Node-Graph-Assistant

A plugin to help you to create node graph faster and easier in unreal engine 4.
390 stars 73 forks source link

Issue with Alt+MiddleClick (break pin) and AutoSizeComments graph node #28

Open fpwong opened 2 years ago

fpwong commented 2 years ago

Problem

Pressing Alt+MiddleClick inside the AutoSizeComment node does not work because it does not recognize the blank space inside the comment.

In NGAInputProcessor::InitEventContex to detect if the cursor is over blank space inside a comment, the plugin checks the index in the widget path. This doesn't work with the AutoSizeComment graph node because it is constructed differently and so node will not be at the same index in the widget path as the default SGraphNodeComment.

Solution

Instead we can check if the widget path contains a SInlineEditableTextBlock with a higher index, which is another way of checking if the cursor is hovering the title bar. This can be done by editing the branch at NGAInputProcessor.cpp:line 224

if (widgetName.Contains("Node") && widgetName.Contains("Comment"))
{
    ctx.IsCursorOnPanelEmptySpace = true;

    // if a previous widget in the path is a SInlineEditableTextBlock then the cursor is over the title bar
    for (int j = i; j < widgetsUnderCursor.Widgets.Num(); j++)
    {
        FString previousWidgetName = widgetsUnderCursor.Widgets[j].Widget->GetTypeAsString();
        if (previousWidgetName == "SInlineEditableTextBlock")
        {
            ctx.IsCursorOnPanelEmptySpace = false;
            break;
        }
    }
}
pdlogingithub commented 1 year ago

I will take a look.