mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-12 11:07:40 +08:00
Tests refactoring, minor additions
This commit is contained in:
@@ -67,9 +67,11 @@ export default class Configuration {
|
||||
static nodeRadius = 8 // px
|
||||
static nodeReflowEventName = "ueb-node-reflow"
|
||||
static nodeType = {
|
||||
callArrayFunction: "/Script/BlueprintGraph.K2Node_CallArrayFunction",
|
||||
callFunction: "/Script/BlueprintGraph.K2Node_CallFunction",
|
||||
comment: "/Script/UnrealEd.EdGraphNode_Comment",
|
||||
commutativeAssociativeBinaryOperator: "/Script/BlueprintGraph.K2Node_CommutativeAssociativeBinaryOperator",
|
||||
componentBoundEvent: "/Script/BlueprintGraph.K2Node_ComponentBoundEvent",
|
||||
customEvent: "/Script/BlueprintGraph.K2Node_CustomEvent",
|
||||
doN: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:Do N",
|
||||
dynamicCast: "/Script/BlueprintGraph.K2Node_DynamicCast",
|
||||
@@ -94,6 +96,7 @@ export default class Configuration {
|
||||
makeMap: "/Script/BlueprintGraph.K2Node_MakeMap",
|
||||
makeSet: "/Script/BlueprintGraph.K2Node_MakeSet",
|
||||
pawn: "/Script/Engine.Pawn",
|
||||
promotableOperator: "/Script/BlueprintGraph.K2Node_PromotableOperator",
|
||||
reverseForEachLoop: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:ReverseForEachLoop",
|
||||
select: "/Script/BlueprintGraph.K2Node_Select",
|
||||
userDefinedEnum: "/Script/Engine.UserDefinedEnum",
|
||||
|
||||
@@ -101,9 +101,13 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
if (
|
||||
nodeEntity.getClass() === Configuration.nodeType.callFunction
|
||||
|| nodeEntity.getClass() === Configuration.nodeType.commutativeAssociativeBinaryOperator
|
||||
|| nodeEntity.getClass() === Configuration.nodeType.callArrayFunction
|
||||
) {
|
||||
const memberParent = nodeEntity.FunctionReference.MemberParent?.path ?? ""
|
||||
if (memberParent === "/Script/Engine.KismetMathLibrary") {
|
||||
if (
|
||||
memberParent === "/Script/Engine.KismetMathLibrary"
|
||||
|| memberParent === "/Script/Engine.KismetArrayLibrary"
|
||||
) {
|
||||
if (nodeEntity.FunctionReference.MemberName?.startsWith("Conv_")) {
|
||||
return VariableConversionNodeTemplate
|
||||
}
|
||||
@@ -111,7 +115,10 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
return VariableOperationNodeTemplate
|
||||
}
|
||||
switch (nodeEntity.FunctionReference.MemberName) {
|
||||
case "Array_Add":
|
||||
case "Array_Identical":
|
||||
case "Abs":
|
||||
case "Array_Add":
|
||||
case "BMax":
|
||||
case "BMin":
|
||||
case "Exp":
|
||||
@@ -137,6 +144,8 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
case Configuration.nodeType.event:
|
||||
case Configuration.nodeType.customEvent:
|
||||
return EventNodeTemplate
|
||||
case Configuration.nodeType.promotableOperator:
|
||||
return VariableOperationNodeTemplate
|
||||
case Configuration.nodeType.knot: return KnotNodeTemplate
|
||||
case Configuration.nodeType.variableGet: return VariableAccessNodeTemplate
|
||||
case Configuration.nodeType.variableSet: return VariableAccessNodeTemplate
|
||||
|
||||
@@ -46,6 +46,18 @@ export default class ObjectEntity extends IEntity {
|
||||
value: null,
|
||||
showDefault: false,
|
||||
},
|
||||
DelegatePropertyName: {
|
||||
type: String,
|
||||
showDefault: false,
|
||||
},
|
||||
DelegateOwnerClass: {
|
||||
type: ObjectReferenceEntity,
|
||||
showDefault: false,
|
||||
},
|
||||
ComponentPropertyName: {
|
||||
type: String,
|
||||
showDefault: false,
|
||||
},
|
||||
EventReference: {
|
||||
type: FunctionReferenceEntity,
|
||||
value: null,
|
||||
@@ -246,17 +258,29 @@ export default class ObjectEntity extends IEntity {
|
||||
/** @type {String} */ this.Name
|
||||
/** @type {SymbolEntity?} */ this.AxisKey
|
||||
/** @type {SymbolEntity?} */ this.InputAxisKey
|
||||
/** @type {SymbolEntity?} */ this.InputKey
|
||||
/** @type {Boolean?} */ this.bIsPureFunc
|
||||
/** @type {Boolean?} */ this.bIsConstFunc
|
||||
/** @type {VariableReferenceEntity?} */ this.VariableReference
|
||||
/** @type {SymbolEntity?} */ this.SelfContextInfo
|
||||
/** @type {String?} */ this.DelegatePropertyName
|
||||
/** @type {ObjectReferenceEntity?} */ this.DelegateOwnerClass
|
||||
/** @type {FunctionReferenceEntity?} */ this.ComponentPropertyName
|
||||
/** @type {FunctionReferenceEntity?} */ this.EventReference
|
||||
/** @type {FunctionReferenceEntity?} */ this.FunctionReference
|
||||
/** @type {String} */ this.CustomFunctionName
|
||||
/** @type {FunctionReferenceEntity?} */ this.EventReference
|
||||
/** @type {ObjectReferenceEntity?} */ this.TargetType
|
||||
/** @type {MacroGraphReferenceEntity?} */ this.MacroGraphReference
|
||||
/** @type {ObjectReferenceEntity?} */ this.Enum
|
||||
/** @type {SymbolEntity?} */ this.InputKey
|
||||
/** @type {Boolean?} */ this.bOverrideFunction
|
||||
/** @type {Boolean?} */ this.bInternalEvent
|
||||
/** @type {Boolean?} */ this.bConsumeInput
|
||||
/** @type {Boolean?} */ this.bExecuteWhenPaused
|
||||
/** @type {Boolean?} */ this.bOverrideParentBinding
|
||||
/** @type {Boolean?} */ this.bControl
|
||||
/** @type {Boolean?} */ this.bAlt
|
||||
/** @type {Boolean?} */ this.bShift
|
||||
/** @type {Boolean?} */ this.bCommand
|
||||
/** @type {LinearColorEntity?} */ this.CommentColor
|
||||
/** @type {Boolean?} */ this.bCommentBubbleVisible_InDetailsPanel
|
||||
/** @type {IntegerEntity} */ this.NodePosX
|
||||
@@ -395,6 +419,7 @@ export default class ObjectEntity extends IEntity {
|
||||
switch (this.getType()) {
|
||||
case Configuration.nodeType.callFunction:
|
||||
case Configuration.nodeType.commutativeAssociativeBinaryOperator:
|
||||
case Configuration.nodeType.promotableOperator:
|
||||
let memberName = this.FunctionReference.MemberName ?? ""
|
||||
const memberParent = this.FunctionReference.MemberParent?.path ?? ""
|
||||
if (memberName === "AddKey") {
|
||||
@@ -410,6 +435,9 @@ export default class ObjectEntity extends IEntity {
|
||||
if (memberName.startsWith("Percent_")) {
|
||||
return "%"
|
||||
}
|
||||
if (memberName.startsWith("EqualEqual_")) {
|
||||
return "=="
|
||||
}
|
||||
const leadingLetter = memberName.match(/[BF]([A-Z]\w+)/)
|
||||
if (leadingLetter) {
|
||||
// Some functions start with B or F (Like FCeil, FMax, BMin)
|
||||
@@ -437,6 +465,8 @@ export default class ObjectEntity extends IEntity {
|
||||
}
|
||||
}
|
||||
return Utility.formatStringName(memberName)
|
||||
case Configuration.nodeType.componentBoundEvent:
|
||||
return `${Utility.formatStringName(this.DelegatePropertyName)} (${this.ComponentPropertyName})`
|
||||
case Configuration.nodeType.dynamicCast:
|
||||
if (!this.TargetType) {
|
||||
return "Bad cast node" // Target type not found
|
||||
@@ -547,6 +577,9 @@ export default class ObjectEntity extends IEntity {
|
||||
return SVGIcon.keyboard
|
||||
}
|
||||
}
|
||||
if (this.getDelegatePin()) {
|
||||
return SVGIcon.event
|
||||
}
|
||||
return SVGIcon.functionSymbol
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user