This commit is contained in:
barsdeveloper
2024-11-27 23:31:57 +01:00
parent 25bb1717df
commit 079fdb59c9
11 changed files with 505 additions and 386 deletions

View File

@@ -5,6 +5,7 @@ import LinearColorEntity from "../entity/LinearColorEntity.js"
import MirroredEntity from "../entity/MirroredEntity.js"
import VectorEntity from "../entity/VectorEntity.js"
const paths = Configuration.paths
const sequencerScriptingNameRegex = /\/Script\/SequencerScripting\.MovieSceneScripting(.+)Channel/
const keyNameValue = {
"A_AccentGrave": "à",
@@ -34,6 +35,66 @@ const keyNameValue = {
"Subtract": "Num -",
"Tilde": "`",
}
const niagaraNodeNames = {
"Boolean::LogicAnd": "Logic AND",
"Boolean::LogicEq": "==",
"Boolean::LogicNEq": "!=",
"Boolean::LogicNot": "Logic NOT",
"Boolean::LogicOr": "Logic OR",
"Integer::BitAnd": "Bitwise AND",
"Integer::BitLShift": "Bitwise Left Shift",
"Integer::BitNot": "Bitwise NOT",
"Integer::BitOr": "Bitwise OR",
"Integer::BitRShift": "Bitwise Right Shift",
"Integer::BitXOr": "Bitwise XOR",
"Integer::EnumEq": "==",
"Integer::EnumNEq": "!=",
"Matrix::MatrixMultiply": "Multiply (Matrix * Matrix)",
"Matrix::MatrixVectorMultiply": "Multiply (Matrix * Vector4)",
// Numeric::
...Object.fromEntries(Object.entries({
"Add": "+",
"ArcCosine": "ArcCosine",
"ArcCosine(Degrees)": "ArcCos(D)",
"ArcCosine(Radians)": "ArcCos(R)",
"ArcSine": "ArcSine",
"ArcSine(Degrees)": "ArcSin(D)",
"ArcSine(Radians)": "ArcSin(R)",
"ArcTangent(Degrees)": "ArcTan(D)",
"ArcTangent(Radians)": "ArcTan(R)",
"CmpEQ": "==",
"CmpGE": ">=",
"CmpGT": ">",
"CmpLE": "<=",
"CmpLT": "<",
"CmpNEQ": "!=",
"Cosine(Degrees)": "Cos(D)",
"Cosine(Radians)": "Cos(R)",
"DegreesToRadians": "DegToRad",
"DistancePos": "Distance",
"Div": String.fromCharCode(0x00f7),
"FMod": "%",
"FModFast": "Modulo Fast",
"Length": "Len",
"Madd": `(A${String.fromCharCode(0x2a2f)}B)+C`,
"Mul": String.fromCharCode(0x2a2f),
"Negate": "-A",
"OneMinus": "1-A",
"PI": String.fromCharCode(0x03C0),
"RadiansToDegrees": "RadToDeg",
"Rand Float": "Random Float",
"Rand Integer": "Random Integer",
"Rand": "Random",
"Rcp": "Reciprocal",
"RSqrt": "Rcp Sqrt",
"Sine(Degrees)": "Sin(D)",
"Sine(Radians)": "Sin(R)",
"Subtract": "-",
"Tangent(Degrees)": "Tan(D)",
"Tangent(Radians)": "Tan(R)",
"TWO_PI": `2 ${String.fromCharCode(0x03C0)}`,
}).map(([k, v]) => ["Numeric::" + k, v])),
}
/** @param {String} value */
function numberFromText(value = "") {
@@ -78,58 +139,58 @@ function keyName(value) {
export default function nodeTitle(entity) {
let value
switch (entity.getType()) {
case Configuration.paths.addDelegate:
case paths.addDelegate:
value ??= "Bind Event to "
case Configuration.paths.clearDelegate:
case paths.clearDelegate:
value ??= "Unbind all Events from "
case Configuration.paths.removeDelegate:
case paths.removeDelegate:
value ??= "Unbind Event from "
return value + Utility.formatStringName(
entity.DelegateReference?.MemberName?.toString().replace(/Delegate$/, "") ?? "None"
)
case Configuration.paths.asyncAction:
case paths.asyncAction:
if (entity.ProxyFactoryFunctionName) {
return Utility.formatStringName(entity.ProxyFactoryFunctionName?.toString())
}
case Configuration.paths.actorBoundEvent:
case Configuration.paths.componentBoundEvent:
case paths.actorBoundEvent:
case paths.componentBoundEvent:
return `${Utility.formatStringName(entity.DelegatePropertyName?.toString())} (${entity.ComponentPropertyName?.toString() ?? "Unknown"})`
case Configuration.paths.callDelegate:
case paths.callDelegate:
return `Call ${entity.DelegateReference?.MemberName?.toString() ?? "None"}`
case Configuration.paths.createDelegate:
case paths.createDelegate:
return "Create Event"
case Configuration.paths.customEvent:
case paths.customEvent:
if (entity.CustomFunctionName) {
return entity.CustomFunctionName?.toString()
}
case Configuration.paths.dynamicCast:
case paths.dynamicCast:
if (!entity.TargetType) {
return "Bad cast node" // Target type not found
}
return `Cast To ${entity.TargetType?.getName()}`
case Configuration.paths.enumLiteral:
case paths.enumLiteral:
return `Literal enum ${entity.Enum?.getName()}`
case Configuration.paths.event:
case paths.event:
return `Event ${(entity.EventReference?.MemberName?.toString() ?? "").replace(/^Receive/, "")}`
case Configuration.paths.executionSequence:
case paths.executionSequence:
return "Sequence"
case Configuration.paths.forEachElementInEnum:
case paths.forEachElementInEnum:
return `For Each ${entity.Enum?.getName()}`
case Configuration.paths.forEachLoopWithBreak:
case paths.forEachLoopWithBreak:
return "For Each Loop with Break"
case Configuration.paths.functionEntry:
case paths.functionEntry:
return entity.FunctionReference?.MemberName?.toString() === "UserConstructionScript"
? "Construction Script"
: entity.FunctionReference?.MemberName?.toString()
case Configuration.paths.functionResult:
case paths.functionResult:
return "Return Node"
case Configuration.paths.ifThenElse:
case paths.ifThenElse:
return "Branch"
case Configuration.paths.makeStruct:
case paths.makeStruct:
if (entity.StructType) {
return `Make ${entity.StructType.getName()}`
}
case Configuration.paths.materialExpressionComponentMask: {
case paths.materialExpressionComponentMask: {
const materialObject = entity.getMaterialSubobject()
if (materialObject) {
return `Mask ( ${Configuration.rgba
@@ -138,15 +199,15 @@ export default function nodeTitle(entity) {
.join("")})`
}
}
case Configuration.paths.materialExpressionConstant:
case paths.materialExpressionConstant:
value ??= [entity.getCustomproperties().find(pinEntity => pinEntity.PinName.toString() == "Value")?.DefaultValue]
case Configuration.paths.materialExpressionConstant2Vector:
case paths.materialExpressionConstant2Vector:
value ??= [
entity.getCustomproperties().find(pinEntity => pinEntity.PinName?.toString() == "X")?.DefaultValue,
entity.getCustomproperties().find(pinEntity => pinEntity.PinName?.toString() == "Y")?.DefaultValue,
]
case Configuration.paths.materialExpressionConstant3Vector:
case Configuration.paths.materialExpressionConstant4Vector:
case paths.materialExpressionConstant3Vector:
case paths.materialExpressionConstant4Vector:
if (!value) {
const vector = entity.getCustomproperties()
.find(pinEntity => pinEntity.PinName?.toString() == "Constant")
@@ -160,32 +221,32 @@ export default function nodeTitle(entity) {
}
value = undefined
break
case Configuration.paths.materialExpressionFunctionInput: {
case paths.materialExpressionFunctionInput: {
const materialObject = entity.getMaterialSubobject()
const inputName = materialObject?.InputName ?? "In"
const inputType = materialObject?.InputType?.value.match(/^.+?_(\w+)$/)?.[1] ?? "Vector3"
return `Input ${inputName} (${inputType})`
}
case Configuration.paths.materialExpressionLogarithm:
case paths.materialExpressionLogarithm:
return "Ln"
case Configuration.paths.materialExpressionLogarithm10:
case paths.materialExpressionLogarithm10:
return "Log10"
case Configuration.paths.materialExpressionLogarithm2:
case paths.materialExpressionLogarithm2:
return "Log2"
case Configuration.paths.materialExpressionMaterialFunctionCall:
case paths.materialExpressionMaterialFunctionCall:
const materialFunction = entity.getMaterialSubobject()?.MaterialFunction
if (materialFunction) {
return materialFunction.getName()
}
break
case Configuration.paths.materialExpressionSquareRoot:
case paths.materialExpressionSquareRoot:
return "Sqrt"
case Configuration.paths.materialExpressionSubtract:
case paths.materialExpressionSubtract:
const materialObject = entity.getMaterialSubobject()
if (materialObject) {
return `Subtract(${materialObject.ConstA ?? "1"},${materialObject.ConstB ?? "1"})`
}
case Configuration.paths.metasoundEditorGraphExternalNode: {
case paths.metasoundEditorGraphExternalNode: {
const name = entity["ClassName"]?.["Name"]
if (name) {
switch (name) {
@@ -194,7 +255,7 @@ export default function nodeTitle(entity) {
}
}
}
case Configuration.paths.niagaraNodeConvert:
case paths.niagaraNodeConvert:
/** @type {String} */
const targetType = (entity["AutowireMakeType"]?.["ClassStructOrEnum"] ?? "")
.toString()
@@ -202,11 +263,11 @@ export default function nodeTitle(entity) {
?.[1]
?? ""
return `Make ${targetType}`
case Configuration.paths.pcgEditorGraphNodeInput:
case paths.pcgEditorGraphNodeInput:
return "Input"
case Configuration.paths.pcgEditorGraphNodeOutput:
case paths.pcgEditorGraphNodeOutput:
return "Output"
case Configuration.paths.spawnActorFromClass:
case paths.spawnActorFromClass:
let className = entity.getCustomproperties()
.find(pinEntity => pinEntity.PinName.toString() == "ReturnValue")
?.PinType
@@ -216,13 +277,13 @@ export default function nodeTitle(entity) {
className = null
}
return `SpawnActor ${Utility.formatStringName(className ?? "NONE")}`
case Configuration.paths.switchEnum:
case paths.switchEnum:
return `Switch on ${entity.Enum?.getName() ?? "Enum"}`
case Configuration.paths.switchInteger:
case paths.switchInteger:
return `Switch on Int`
case Configuration.paths.variableGet:
case paths.variableGet:
return ""
case Configuration.paths.variableSet:
case paths.variableSet:
return "SET"
}
const className = entity.getClass()
@@ -240,14 +301,14 @@ export default function nodeTitle(entity) {
if (keyNameSymbol) {
const name = keyNameSymbol.toString()
let title = keyName(name) ?? Utility.formatStringName(name)
if (className === Configuration.paths.inputDebugKey) {
if (className === paths.inputDebugKey) {
title = "Debug Key " + title
} else if (className === Configuration.paths.getInputAxisKeyValue) {
} else if (className === paths.getInputAxisKeyValue) {
title = "Get " + title
}
return title
}
if (className === Configuration.paths.macro) {
if (className === paths.macro) {
return Utility.formatStringName(entity.MacroGraphReference?.getMacroName())
}
const materialSubobject = entity.getMaterialSubobject()
@@ -267,7 +328,7 @@ export default function nodeTitle(entity) {
}
const settingsObject = entity.getSettingsObject()
if (settingsObject) {
if (settingsObject.ExportPath?.valueOf()?.type === Configuration.paths.pcgHiGenGridSizeSettings) {
if (settingsObject.ExportPath?.valueOf()?.type === paths.pcgHiGenGridSizeSettings) {
return `Grid Size: ${(
settingsObject.HiGenGridSize?.toString().match(/\d+/)?.[0]?.concat("00")
?? settingsObject.HiGenGridSize?.toString().match(/^\w+$/)?.[0]
@@ -309,10 +370,10 @@ export default function nodeTitle(entity) {
)
}
switch (memberParent) {
case Configuration.paths.blueprintGameplayTagLibrary:
case Configuration.paths.kismetMathLibrary:
case Configuration.paths.slateBlueprintLibrary:
case Configuration.paths.timeManagementBlueprintLibrary:
case paths.blueprintGameplayTagLibrary:
case paths.kismetMathLibrary:
case paths.slateBlueprintLibrary:
case paths.timeManagementBlueprintLibrary:
const leadingLetter = memberName.match(/[BF]([A-Z]\w+)/)
if (leadingLetter) {
// Some functions start with B or F (Like FCeil, FMax, BMin)
@@ -396,7 +457,7 @@ export default function nodeTitle(entity) {
return "^"
}
break
case Configuration.paths.blueprintSetLibrary:
case paths.blueprintSetLibrary:
{
const setOperationMatch = memberName.match(/Set_(\w+)/)
if (setOperationMatch) {
@@ -404,7 +465,7 @@ export default function nodeTitle(entity) {
}
}
break
case Configuration.paths.blueprintMapLibrary:
case paths.blueprintMapLibrary:
{
const setOperationMatch = memberName.match(/Map_(\w+)/)
if (setOperationMatch) {
@@ -412,7 +473,7 @@ export default function nodeTitle(entity) {
}
}
break
case Configuration.paths.kismetArrayLibrary:
case paths.kismetArrayLibrary:
{
const arrayOperationMath = memberName.match(/Array_(\w+)/)
if (arrayOperationMath) {
@@ -424,66 +485,8 @@ export default function nodeTitle(entity) {
return Utility.formatStringName(memberName)
}
if (entity.OpName) {
switch (entity.OpName.toString()) {
case "Boolean::LogicAnd": return "Logic AND"
case "Boolean::LogicEq": return "=="
case "Boolean::LogicNEq": return "!="
case "Boolean::LogicNot": return "Logic NOT"
case "Boolean::LogicOr": return "Logic OR"
case "Integer::BitAnd": return "Bitwise AND"
case "Integer::BitLShift": return "Bitwise Left Shift"
case "Integer::BitNot": return "Bitwise NOT"
case "Integer::BitOr": return "Bitwise OR"
case "Integer::BitRShift": return "Bitwise Right Shift"
case "Integer::BitXOr": return "Bitwise XOR"
case "Matrix::MatrixMultiply": return "Multiply (Matrix * Matrix)"
case "Matrix::MatrixVectorMultiply": return "Multiply (Matrix * Vector4)"
case "Numeric::Abs": return "Abs"
case "Numeric::Add": return "+"
case "Numeric::ArcCosine": return "ArcCosine"
case "Numeric::ArcCosine(Degrees)": return "ArcCos(D)"
case "Numeric::ArcCosine(Radians)": return "ArcCos(R)"
case "Numeric::ArcSine": return "ArcSine"
case "Numeric::ArcSine(Degrees)": return "ArcSin(D)"
case "Numeric::ArcSine(Radians)": return "ArcSin(R)"
case "Numeric::ArcTangent": return "ArcTangent"
case "Numeric::ArcTangent(Degrees)": return "ArcTan(D)"
case "Numeric::ArcTangent(Radians)": return "ArcTan(R)"
case "Numeric::CmpEQ": return "=="
case "Numeric::CmpGE": return ">="
case "Numeric::CmpGT": return ">"
case "Numeric::CmpLE": return "<="
case "Numeric::CmpLT": return "<"
case "Numeric::CmpNEQ": return "!="
case "Numeric::Cosine(Degrees)": return "Cos(D)"
case "Numeric::Cosine(Radians)": return "Cos(R)"
case "Numeric::DegreesToRadians": return "DegToRad"
case "Numeric::DistancePos": return "Distance"
case "Numeric::Div": return String.fromCharCode(0x00f7)
case "Numeric::FMod": return "%"
case "Numeric::FModFast": return "Modulo Fast"
case "Numeric::Length": return "Len"
case "Numeric::Madd": return `(A${String.fromCharCode(0x2a2f)}B)+C`
case "Numeric::Mul": return String.fromCharCode(0x2a2f)
case "Numeric::Negate": return "-A"
case "Numeric::OneMinus": return "1-A"
case "Numeric::PI": return String.fromCharCode(0x03C0)
case "Numeric::RadiansToDegrees": return "RadToDeg"
case "Numeric::Rand Float": return "Random Float"
case "Numeric::Rand Integer": return "Random Integer"
case "Numeric::Rand": return "Random"
case "Numeric::Rcp": return "Reciprocal"
case "Numeric::RSqrt": return "Rcp Sqrt"
case "Numeric::Sine(Degrees)": return "Sin(D)"
case "Numeric::Sine(Radians)": return "Sin(R)"
case "Numeric::Subtract": return "-"
case "Numeric::Tangent(Degrees)": return "Tan(D)"
case "Numeric::Tangent(Radians)": return "Tan(R)"
case "Numeric::TWO_PI": return `2 ${String.fromCharCode(0x03C0)}`
// case "Integer::BitOr": return "Bitwise OR"
// case "Integer::BitOr": return "Bitwise OR"
}
return Utility.formatStringName(entity.OpName.toString().replaceAll(/(?:^\w+(?<!^Matrix))?::/g, " "))
return niagaraNodeNames[entity.OpName.toString()]
?? Utility.formatStringName(entity.OpName.toString().replaceAll(/(?:^\w+(?<!^Matrix))?::/g, " "))
}
if (entity.FunctionDisplayName) {
return Utility.formatStringName(entity.FunctionDisplayName.toString())