MCPcopy Create free account
hub / github.com/BobbyAnguelov/Esoterica / UpdateAndDraw

Method UpdateAndDraw

Code/EngineTools/NodeGraph/NodeGraph_View.cpp:930–1147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

928 // Broad hit-test
929 ImRect commentNodeRect = pNode->GetRect();
930 commentNodeRect.Expand( dilationRadius );
931 if ( commentNodeRect.Contains( ctx.m_mouseCanvasPos ) )
932 {
933 // Test title region
934 ImRect commentNodeTitleRect( pNode->GetRect().Min, ctx.ScreenToCanvasPosition( titleRectMax ) );
935 commentNodeTitleRect.Expand( dilationRadius );
936 if ( commentNodeTitleRect.Contains( ctx.m_mouseCanvasPos ) )
937 {
938 pNode->m_isHovered = true;
939 }
940 // Test Edges
941 else if ( pNode->GetHoveredResizeHandle( ctx ) != ResizeHandle::None )
942 {
943 pNode->m_isHovered = true;
944 }
945 }
946 }
947 }
948
949 //-------------------------------------------------------------------------
950
951 void GraphView::UpdateAndDraw( TypeSystem::TypeRegistry const& typeRegistry, float childHeightOverride )
952 {
953 EE_ASSERT( m_pUserContext != nullptr );
954
955 // Update context
956 //-------------------------------------------------------------------------
957
958 m_pUserContext->m_isAltDown = ImGui::GetIO().KeyAlt;
959 m_pUserContext->m_isCtrlDown = ImGui::GetIO().KeyCtrl;
960 m_pUserContext->m_isShiftDown = ImGui::GetIO().KeyShift;
961 m_pUserContext->m_isReadOnly = m_isReadOnly;
962
963 // Node visual update
964 //-------------------------------------------------------------------------
965
966 if ( m_pGraph != nullptr )
967 {
968 for ( TTypeInstance<BaseNode>& nodeInstance : m_pGraph->m_nodes )
969 {
970 nodeInstance->PreDrawUpdate( m_pUserContext );
971 }
972 }
973
974 // Draw Graph
975 //-------------------------------------------------------------------------
976
977 DrawContext drawingContext;
978 drawingContext.m_isReadOnly = m_isReadOnly;
979
980 if ( BeginDrawCanvas( childHeightOverride ) )
981 {
982 auto pWindow = ImGui::GetCurrentWindow();
983 ImVec2 const mousePos = ImGui::GetMousePos();
984
985 drawingContext.SetViewScaleFactor( m_pGraph != nullptr ? m_pGraph->m_viewScaleFactor : 1.0f );
986 drawingContext.m_pDrawList = ImGui::GetWindowDrawList();
987 drawingContext.m_viewOffset = *m_pViewOffset;

Callers 3

UpdateAndDrawDialogMethod · 0.45

Calls 15

GetCurrentWindowFunction · 0.85
GetFlowGraphFunction · 0.85
ImVec2Function · 0.85
IsHoveredOverCurveFunction · 0.85
MaxFunction · 0.85
EndDragDropTargetFunction · 0.85
SetViewScaleFactorMethod · 0.80
GetSizeMethod · 0.80
ScaleAllSizesMethod · 0.80
GetNodeMethod · 0.80

Tested by

no test coverage detected