MCPcopy Create free account
hub / github.com/MrDrElliot/LuminaEngine / DrawGraph

Method DrawGraph

Engine/Editor/Source/UI/Tools/NodeGraph/EdNodeGraph.cpp:282–930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280 Line = Candidate;
281 }
282 else
283 {
284 OutLines.Add(Line);
285 Line = Word;
286 }
287 WordStart = WordEnd + 1;
288 }
289 OutLines.Add(Line);
290 ParagraphStart = ParagraphEnd + 1;
291 }
292 }
293
294 // Cuts a line that does not fit at a whole character and ends it with an ellipsis.
295 void AddTextEllipsized(ImDrawList* DrawList, ImFont* Font, float FontSize, ImVec2 Position, ImU32 Color, const FString& Text, float MaxWidth)
296 {
297 const char* Begin = *Text;
298 const char* End = Begin + Text.Len();
299 if (Font->CalcTextSizeA(FontSize, FLT_MAX, 0.0f, Begin, End).x <= MaxWidth)
300 {
301 DrawList->AddText(Font, FontSize, Position, Color, Begin, End);
302 return;
303 }
304
305 constexpr const char* Ellipsis = "...";
306 const float EllipsisWidth = Font->CalcTextSizeA(FontSize, FLT_MAX, 0.0f, Ellipsis).x;
307 while (End > Begin && Font->CalcTextSizeA(FontSize, FLT_MAX, 0.0f, Begin, End).x + EllipsisWidth > MaxWidth)
308 {
309 do
310 {
311 --End;
312 }
313 while (End > Begin && (*End & 0xC0) == 0x80);
314 }
315
316 FString Shown(Begin, IntCastChecked<int32>(End - Begin));
317 Shown += Ellipsis;
318 DrawList->AddText(Font, FontSize, Position, Color, *Shown, *Shown + Shown.Len());
319 }
320 }
321
322 void CEdNodeGraph::DrawRerouteNode(CEdGraphNode* Node)
323 {
324 // The knot itself moves the node, and a lobe either side of it takes or gives a wire.
325 constexpr float LobeReach = GRerouteKnotRadius * 2.5f;
326
327 CEdNodeGraphPin* InputPin = Node->GetInputPins().IsEmpty() ? nullptr : Node->GetInputPins()[0].Get();
328 CEdNodeGraphPin* OutputPin = Node->GetOutputPins().IsEmpty() ? nullptr : Node->GetOutputPins()[0].Get();
329 const ImU32 Color = OutputPin != nullptr ? GetWireColor(OutputPin) : IM_COL32_WHITE;
330
331 FGraphNodeStyle Style;
332 Style.Padding = ImVec4(0.0f, 0.0f, 0.0f, 0.0f);
333 Style.Rounding = GRerouteKnotRadius;
334 Style.BorderWidth = 0.0f;
335 Style.HoveredBorderWidth = 1.5f;
336 Style.SelectedBorderWidth = 2.0f;
337 Style.Background = 0;
338
339 BeginCanvasNode(Node, Style);

Callers 3

DrawMaterialGraphMethod · 0.80
DrawGraphWindowMethod · 0.80
DrawGraphWindowMethod · 0.80

Calls 15

PushStyleVarFunction · 0.85
PopStyleVarFunction · 0.85
TextFunction · 0.85
PushStyleColorFunction · 0.85
DrawPinIconFunction · 0.85
TextUnformattedFunction · 0.85
PopStyleColorFunction · 0.85
find_ifFunction · 0.85
GetSchemaFunction · 0.85
ImColorClass · 0.85
HeaderMethod · 0.80
EndHeaderMethod · 0.80

Tested by

no test coverage detected