Files
ueblueprint/js/decoding/nodeIcon.js
BarsDev 6ba2705386 Large refactoring and new nodes
* Fix node reference when changing elements

* Fix ScriptVariables parsing

* Fix invariant text and niagara types

* Niagara convert nodes

* Move node tests to own files

* More Niagara tests

* Niagara float and smaller fixes

* More Decoding

* More decoding

* WIP

* Float is real

* WIP

* More types and colors

* Test case and small polish

* WIP

* WIP

* Fix niagara script variables merging

* Fix Niagara variables

* Fixing mirrored ExportPath

* Fix Export paths name adjustments

* Simplify arc calculation

* Simplify a bit arc calculation

* source / destionation => origin / target

* Minor refactoring

* Fix switched link position

* Rename some properties for uniformity

* Fix input escape

* Simplify test

* About window

* Dialog backdrop style

* About dialog touches

* Remove dependency and minot improvement

* Light mode

* Fix link location and css small improvement

* Link direction and minor fixes

* Some minor fixes and refactoring

* Refactoring WIP

* Shorting repetitive bits

* More tests

* Simplify linking tests
2025-02-07 00:36:03 +02:00

83 lines
2.8 KiB
JavaScript
Executable File

import Configuration from "../Configuration.js"
import SVGIcon from "../SVGIcon.js"
import nodeTitle from "./nodeTitle.js"
const p = Configuration.paths
/** @param {ObjectEntity} entity */
export default function nodeIcon(entity) {
if (entity.isMaterial() || entity.isPcg() || entity.isNiagara()) {
return null
}
switch (entity.getType()) {
case p.addDelegate:
case p.asyncAction:
case p.callDelegate:
case p.clearDelegate:
case p.createDelegate:
case p.functionEntry:
case p.functionResult:
case p.removeDelegate:
return SVGIcon.node
case p.customEvent: return SVGIcon.event
case p.doN: return SVGIcon.doN
case p.doOnce: return SVGIcon.doOnce
case p.dynamicCast: return SVGIcon.cast
case p.enumLiteral: return SVGIcon.enum
case p.event: return SVGIcon.event
case p.executionSequence:
case p.multiGate:
return SVGIcon.sequence
case p.flipflop:
return SVGIcon.flipflop
case p.forEachElementInEnum:
case p.forLoop:
case p.forLoopWithBreak:
case p.whileLoop:
return SVGIcon.loop
case p.forEachLoop:
case p.forEachLoopWithBreak:
return SVGIcon.forEachLoop
case p.ifThenElse: return SVGIcon.branchNode
case p.isValid: return SVGIcon.questionMark
case p.makeArray: return SVGIcon.makeArray
case p.makeMap: return SVGIcon.makeMap
case p.makeSet: return SVGIcon.makeSet
case p.makeStruct: return SVGIcon.makeStruct
case p.metasoundEditorGraphExternalNode: return SVGIcon.metasoundFunction
case p.select: return SVGIcon.select
case p.spawnActorFromClass: return SVGIcon.spawnActor
case p.timeline: return SVGIcon.timer
}
if (entity.switchTarget()) {
return SVGIcon.switch
}
if (nodeTitle(entity).startsWith("Break")) {
return SVGIcon.breakStruct
}
if (entity.getClass() === p.macro) {
return SVGIcon.macro
}
const hidValue = entity.getHIDAttribute()?.toString()
if (hidValue) {
if (hidValue.includes("Mouse")) {
return SVGIcon.mouse
} else if (hidValue.includes("Gamepad_Special")) {
return SVGIcon.keyboard // It is called Touchpad in UE
} else if (hidValue.includes("Gamepad") || hidValue.includes("Steam")) {
return SVGIcon.gamepad
} else if (hidValue.includes("Touch")) {
return SVGIcon.touchpad
} else {
return SVGIcon.keyboard
}
}
if (entity.getDelegatePin()) {
return SVGIcon.event
}
if (entity.ObjectRef?.type === p.ambientSound) {
return SVGIcon.sound
}
return SVGIcon.functionSymbol
}