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

Method DrawFlowNode

Code/EngineTools/NodeGraph/NodeGraph_View.cpp:548–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

546 }
547 else
548 {
549 if ( visualState.IsFlagSet( NodeVisualState::Selected ) )
550 {
551 ImGuiX::DrawArrow( ctx.m_pDrawList, ctx.CanvasToScreenPosition( startPoint ), ctx.CanvasToScreenPosition( endPoint ), conduitColor, scaledArrowWidth * 1.5f, scaledArrowHeadWidth * 1.5f );
552 }
553 else
554 {
555 ImGuiX::DrawArrow( ctx.m_pDrawList, ctx.CanvasToScreenPosition( startPoint ), ctx.CanvasToScreenPosition( endPoint ), conduitColor, scaledArrowWidth, scaledArrowHeadWidth );
556 }
557 }
558
559 // Update transition position and size
560 //-------------------------------------------------------------------------
561
562 ImVec2 const min( Math::Min( startPoint.x, endPoint.x ), Math::Min( startPoint.y, endPoint.y ) );
563 ImVec2 const max( Math::Max( startPoint.x, endPoint.x ), Math::Max( startPoint.y, endPoint.y ) );
564 pTransitionConduit->m_canvasPosition = min;
565 pTransitionConduit->m_size = max - min;
566 }
567
568 void GraphView::DrawFlowNode( DrawContext const& ctx, FlowNode* pNode )
569 {
570 EE_ASSERT( pNode != nullptr );
571
572 if ( !pNode->IsVisible() )
573 {
574 return;
575 }
576
577 //-------------------------------------------------------------------------
578 // Split Channels
579 //-------------------------------------------------------------------------
580
581 ImGui::PushID( pNode );
582
583 ctx.SplitDrawChannels();
584
585 //-------------------------------------------------------------------------
586 // Draw Node Contents
587 //-------------------------------------------------------------------------
588
589 ctx.SetDrawChannel( (uint8_t) DrawChannel::Foreground );
590
591 ImVec2 newNodeWindowSize( 0, 0 );
592 ImVec2 const windowPosition = ctx.CanvasToWindowPosition( pNode->GetPosition() );
593 ImVec2 const scaledNodeMargin = ctx.CanvasToWindow( pNode->GetNodeMargin() );
594 ImVec2 const scaledColorItemSpacing( ( Style::s_titleBarColorItemWidth * ctx.m_viewScaleFactor ) - scaledNodeMargin.x, 0 );
595
596 ImGui::SetCursorPos( windowPosition );
597 ImGui::BeginGroup();
598 {
599
600 // Draw Title
601 //-------------------------------------------------------------------------
602
603 {
604 ImGuiX::ScopedFont fontOverride( ImGuiX::Font::MediumBold, Colors::White );
605 ImGui::BeginGroup();

Callers

nothing calls this directly

Calls 15

PushStyleVarFunction · 0.85
ImVec2Function · 0.85
MaxFunction · 0.85
PopStyleVarFunction · 0.85
IsNodeSelectedFunction · 0.85
SplitDrawChannelsMethod · 0.80
SetDrawChannelMethod · 0.80
CanvasToWindowMethod · 0.80
WindowToCanvasMethod · 0.80
GetPinColorMethod · 0.80

Tested by

no test coverage detected