Minor refactoring

This commit is contained in:
barsdeveloper
2025-01-25 01:41:32 +02:00
parent dfa402707c
commit 1d9a88125e
13 changed files with 176 additions and 104 deletions

96
dist/ueblueprint.js vendored
View File

@@ -109,7 +109,7 @@ class Configuration {
? 50 + (c2 - start)
: 50;
const fin = arc ? end + c1 - start : end - c1 + start;
return `M ${start} 0 C ${c1.toFixed(2)} 0, ${c2.toFixed(2)} 0, ${mid} 50 S ${fin.toFixed(2)} 100, `
return `M ${start} 0 C ${c1.toFixed(2)} 0, ${c2.toFixed(2)} 0, ${mid.toFixed(2)} 50 S ${fin.toFixed(2)} 100, `
+ `${end.toFixed(3)} 100`
}
static maxZoom = 7
@@ -7681,60 +7681,34 @@ class LinkTemplate extends IFromToPositionedTemplate {
// Switch actual input/output pins if allowed and makes sense
if (isOriginAKnot && (!targetPin || isTargetAKnot)) {
if (originPin?.isInputLoosely() && to > from + Configuration.distanceThreshold) {
this.element.origin = /** @type {KnotPinTemplate} */(originPin.template).oppositePin();
this.element.origin = /** @type {KnotPinTemplate} */(originPin.template).getoppositePin();
} else if (originPin?.isOutputLoosely() && to < from - Configuration.distanceThreshold) {
this.element.origin = /** @type {KnotPinTemplate} */(originPin.template).oppositePin();
this.element.origin = /** @type {KnotPinTemplate} */(originPin.template).getoppositePin();
}
}
if (isTargetAKnot && (!originPin || isOriginAKnot)) {
if (targetPin?.isInputLoosely() && to < from - Configuration.distanceThreshold) {
this.element.target = /** @type {KnotPinTemplate} */(targetPin.template).oppositePin();
this.element.target = /** @type {KnotPinTemplate} */(targetPin.template).getoppositePin();
} else if (targetPin?.isOutputLoosely() && to > from + Configuration.distanceThreshold) {
this.element.target = /** @type {KnotPinTemplate} */(targetPin.template).oppositePin();
this.element.target = /** @type {KnotPinTemplate} */(targetPin.template).getoppositePin();
}
}
// Switch visual input/output pins if allowed and makes sense
let directionsCheckedKnot;
if (
originPin?.isKnot()
&& !changedProperties.has("fromX")
&& changedProperties.has("toX")
) {
// The target end has moved and origin end is a knot
directionsCheckedKnot = originPin.nodeElement;
} else if (
targetPin?.isKnot()
&& changedProperties.has("toX")
&& !changedProperties.has("fromX")
) {
// The origin end has moved and target end is a knot
directionsCheckedKnot = targetPin.nodeElement;
}
if (directionsCheckedKnot) {
let leftPinsLocation = 0;
let leftPinsCount = 0;
let rightPinsLocation = 0;
let rightPinsCount = 0;
const pins = directionsCheckedKnot.template
.getAllConnectedLinks()
.map(l => l.getOtherPin(directionsCheckedKnot));
for (const pin of pins) {
if (pin.isInput()) {
rightPinsLocation += pin.getLinkLocation()[0];
++rightPinsCount;
} else if (pin.isOutput()) {
leftPinsLocation += pin.getLinkLocation()[0];
++leftPinsCount;
}
if (originPin && targetPin) {
let directionsCheckedKnot;
if (originPin?.isKnot()) {
// The target end has moved and origin end is a knot
directionsCheckedKnot = originPin.nodeElement;
} else if (targetPin?.isKnot()) {
// The origin end has moved and target end is a knot
directionsCheckedKnot = targetPin.nodeElement;
}
leftPinsLocation /= leftPinsCount;
rightPinsLocation /= rightPinsCount;
const knotTemplate = /** @type {KnotNodeTemplate} */(directionsCheckedKnot.template);
if ((rightPinsLocation < leftPinsLocation) != knotTemplate.switchDirectionsVisually) {
knotTemplate.switchDirectionsVisually = rightPinsLocation < leftPinsLocation;
if (directionsCheckedKnot && directionsCheckedKnot.hasUpdated) {
/** @type {KnotNodeTemplate} */(directionsCheckedKnot.template).checkSwtichDirectionsVisually();
}
}
let sameDirection = originPin?.isOutputVisually() == targetPin?.isOutputVisually();
// Actual computation
@@ -9434,7 +9408,7 @@ class MouseCreateLink extends IMouseClickDrag {
const otherPin = this.#knotPin !== this.link.origin ? this.link.origin : this.enteredPin;
// Knot pin direction correction
if (this.#knotPin.isInput() && otherPin.isInput() || this.#knotPin.isOutput() && otherPin.isOutput()) {
const oppositePin = /** @type {KnotPinTemplate} */(this.#knotPin.template).oppositePin();
const oppositePin = /** @type {KnotPinTemplate} */(this.#knotPin.template).getoppositePin();
if (this.#knotPin === this.link.origin) {
this.link.origin = oppositePin;
} else {
@@ -9445,7 +9419,7 @@ class MouseCreateLink extends IMouseClickDrag {
this.#knotPin = this.enteredPin;
if (this.link.origin.isOutput()) {
// Knot uses by default the output pin, let's switch to keep it coherent with the origin node we have
this.enteredPin = /** @type {KnotPinTemplate} */(this.enteredPin.template).oppositePin();
this.enteredPin = /** @type {KnotPinTemplate} */(this.enteredPin.template).getoppositePin();
}
}
if (!this.link.origin.getLinks().find(ref => ref.equals(this.enteredPin.createPinReference()))) {
@@ -9699,9 +9673,12 @@ class PinTemplate extends ITemplate {
}
getLinkLocation() {
const rect = this.iconElement.getBoundingClientRect();
const rect = (this.#iconElement ?? this.element).getBoundingClientRect();
/** @type {[Number, Number]} */
const boundingLocation = [this.element.isInputVisually() ? rect.left : rect.right + 1, (rect.top + rect.bottom) / 2];
const boundingLocation = [
this.element.isInputVisually() ? rect.left : rect.right + 1,
(rect.top + rect.bottom) / 2
];
const location = Utility.convertLocation(boundingLocation, this.blueprint.template.gridElement);
return this.blueprint.compensateTranslation(location[0], location[1])
}
@@ -9809,14 +9786,15 @@ class KnotPinTemplate extends MinimalPinTemplate {
return this.element.isOutput() ? super.render() : x``
}
oppositePin() {
getoppositePin() {
const nodeTemplate = /** @type {KnotNodeTemplate} */(this.element.nodeElement.template);
return this.element.isOutput() ? nodeTemplate.inputPin : nodeTemplate.outputPin
}
/** Location on the grid of a link connecting to this pin */
getLinkLocation() {
if (this.element.isInput()) {
return this.oppositePin().getLinkLocation()
return this.getoppositePin().getLinkLocation()
}
return super.getLinkLocation()
}
@@ -9879,7 +9857,29 @@ class KnotNodeTemplate extends NodeTemplate {
}
linksChanged() {
}
checkSwtichDirectionsVisually() {
let leftPinsLocation = 0;
let leftPinsCount = 0;
let rightPinsLocation = 0;
let rightPinsCount = 0;
const links = this.getAllConnectedLinks();
for (const link of links) {
const pin = link.getOtherPin(this.element);
if (pin?.isInput()) {
rightPinsLocation += pin.getLinkLocation()[0];
++rightPinsCount;
} else if (pin?.isOutput()) {
leftPinsLocation += pin.getLinkLocation()[0];
++leftPinsCount;
}
}
leftPinsLocation /= leftPinsCount;
rightPinsLocation /= rightPinsCount;
if ((rightPinsLocation < leftPinsLocation) != this.switchDirectionsVisually) {
this.switchDirectionsVisually = rightPinsLocation < leftPinsLocation;
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -85,7 +85,7 @@ export default class Configuration {
? 50 + (c2 - start)
: 50
const fin = arc ? end + c1 - start : end - c1 + start
return `M ${start} 0 C ${c1.toFixed(2)} 0, ${c2.toFixed(2)} 0, ${mid} 50 S ${fin.toFixed(2)} 100, `
return `M ${start} 0 C ${c1.toFixed(2)} 0, ${c2.toFixed(2)} 0, ${mid.toFixed(2)} 50 S ${fin.toFixed(2)} 100, `
+ `${end.toFixed(3)} 100`
}
static maxZoom = 7

View File

@@ -115,7 +115,7 @@ export default class MouseCreateLink extends IMouseClickDrag {
const otherPin = this.#knotPin !== this.link.origin ? this.link.origin : this.enteredPin
// Knot pin direction correction
if (this.#knotPin.isInput() && otherPin.isInput() || this.#knotPin.isOutput() && otherPin.isOutput()) {
const oppositePin = /** @type {KnotPinTemplate} */(this.#knotPin.template).oppositePin()
const oppositePin = /** @type {KnotPinTemplate} */(this.#knotPin.template).getoppositePin()
if (this.#knotPin === this.link.origin) {
this.link.origin = oppositePin
} else {
@@ -126,7 +126,7 @@ export default class MouseCreateLink extends IMouseClickDrag {
this.#knotPin = this.enteredPin
if (this.link.origin.isOutput()) {
// Knot uses by default the output pin, let's switch to keep it coherent with the origin node we have
this.enteredPin = /** @type {KnotPinTemplate} */(this.enteredPin.template).oppositePin()
this.enteredPin = /** @type {KnotPinTemplate} */(this.enteredPin.template).getoppositePin()
}
}
if (!this.link.origin.getLinks().find(ref => ref.equals(this.enteredPin.createPinReference()))) {

View File

@@ -74,60 +74,34 @@ export default class LinkTemplate extends IFromToPositionedTemplate {
// Switch actual input/output pins if allowed and makes sense
if (isOriginAKnot && (!targetPin || isTargetAKnot)) {
if (originPin?.isInputLoosely() && to > from + Configuration.distanceThreshold) {
this.element.origin = /** @type {KnotPinTemplate} */(originPin.template).oppositePin()
this.element.origin = /** @type {KnotPinTemplate} */(originPin.template).getoppositePin()
} else if (originPin?.isOutputLoosely() && to < from - Configuration.distanceThreshold) {
this.element.origin = /** @type {KnotPinTemplate} */(originPin.template).oppositePin()
this.element.origin = /** @type {KnotPinTemplate} */(originPin.template).getoppositePin()
}
}
if (isTargetAKnot && (!originPin || isOriginAKnot)) {
if (targetPin?.isInputLoosely() && to < from - Configuration.distanceThreshold) {
this.element.target = /** @type {KnotPinTemplate} */(targetPin.template).oppositePin()
this.element.target = /** @type {KnotPinTemplate} */(targetPin.template).getoppositePin()
} else if (targetPin?.isOutputLoosely() && to > from + Configuration.distanceThreshold) {
this.element.target = /** @type {KnotPinTemplate} */(targetPin.template).oppositePin()
this.element.target = /** @type {KnotPinTemplate} */(targetPin.template).getoppositePin()
}
}
// Switch visual input/output pins if allowed and makes sense
let directionsCheckedKnot
if (
originPin?.isKnot()
&& !changedProperties.has("fromX")
&& changedProperties.has("toX")
) {
// The target end has moved and origin end is a knot
directionsCheckedKnot = originPin.nodeElement
} else if (
targetPin?.isKnot()
&& changedProperties.has("toX")
&& !changedProperties.has("fromX")
) {
// The origin end has moved and target end is a knot
directionsCheckedKnot = targetPin.nodeElement
}
if (directionsCheckedKnot) {
let leftPinsLocation = 0
let leftPinsCount = 0
let rightPinsLocation = 0
let rightPinsCount = 0
const pins = directionsCheckedKnot.template
.getAllConnectedLinks()
.map(l => l.getOtherPin(directionsCheckedKnot))
for (const pin of pins) {
if (pin.isInput()) {
rightPinsLocation += pin.getLinkLocation()[0]
++rightPinsCount
} else if (pin.isOutput()) {
leftPinsLocation += pin.getLinkLocation()[0]
++leftPinsCount
}
if (originPin && targetPin) {
let directionsCheckedKnot
if (originPin?.isKnot()) {
// The target end has moved and origin end is a knot
directionsCheckedKnot = originPin.nodeElement
} else if (targetPin?.isKnot()) {
// The origin end has moved and target end is a knot
directionsCheckedKnot = targetPin.nodeElement
}
leftPinsLocation /= leftPinsCount
rightPinsLocation /= rightPinsCount
const knotTemplate = /** @type {KnotNodeTemplate} */(directionsCheckedKnot.template)
if ((rightPinsLocation < leftPinsLocation) != knotTemplate.switchDirectionsVisually) {
knotTemplate.switchDirectionsVisually = rightPinsLocation < leftPinsLocation
if (directionsCheckedKnot && directionsCheckedKnot.hasUpdated) {
/** @type {KnotNodeTemplate} */(directionsCheckedKnot.template).checkSwtichDirectionsVisually()
}
}
let sameDirection = originPin?.isOutputVisually() == targetPin?.isOutputVisually()
// Actual computation

View File

@@ -60,6 +60,28 @@ export default class KnotNodeTemplate extends NodeTemplate {
}
linksChanged() {
}
checkSwtichDirectionsVisually() {
let leftPinsLocation = 0
let leftPinsCount = 0
let rightPinsLocation = 0
let rightPinsCount = 0
const links = this.getAllConnectedLinks()
for (const link of links) {
const pin = link.getOtherPin(this.element)
if (pin?.isInput()) {
rightPinsLocation += pin.getLinkLocation()[0]
++rightPinsCount
} else if (pin?.isOutput()) {
leftPinsLocation += pin.getLinkLocation()[0]
++leftPinsCount
}
}
leftPinsLocation /= leftPinsCount
rightPinsLocation /= rightPinsCount
if ((rightPinsLocation < leftPinsLocation) != this.switchDirectionsVisually) {
this.switchDirectionsVisually = rightPinsLocation < leftPinsLocation
}
}
}

View File

@@ -8,14 +8,15 @@ export default class KnotPinTemplate extends MinimalPinTemplate {
return this.element.isOutput() ? super.render() : html``
}
oppositePin() {
getoppositePin() {
const nodeTemplate = /** @type {KnotNodeTemplate} */(this.element.nodeElement.template)
return this.element.isOutput() ? nodeTemplate.inputPin : nodeTemplate.outputPin
}
/** Location on the grid of a link connecting to this pin */
getLinkLocation() {
if (this.element.isInput()) {
return this.oppositePin().getLinkLocation()
return this.getoppositePin().getLinkLocation()
}
return super.getLinkLocation()
}

View File

@@ -172,9 +172,12 @@ export default class PinTemplate extends ITemplate {
}
getLinkLocation() {
const rect = this.iconElement.getBoundingClientRect()
const rect = (this.#iconElement ?? this.element).getBoundingClientRect()
/** @type {[Number, Number]} */
const boundingLocation = [this.element.isInputVisually() ? rect.left : rect.right + 1, (rect.top + rect.bottom) / 2]
const boundingLocation = [
this.element.isInputVisually() ? rect.left : rect.right + 1,
(rect.top + rect.bottom) / 2
]
const location = Utility.convertLocation(boundingLocation, this.blueprint.template.gridElement)
return this.blueprint.compensateTranslation(location[0], location[1])
}

View File

@@ -1,10 +1,5 @@
import { expect, test } from "./fixtures/test.js"
test.beforeEach(async ({ blueprintPage }) => {
await blueprintPage.removeNodes()
})
test("Issue 27", async ({ blueprintPage }) => {
await blueprintPage.paste(String.raw`
Begin Object Class=/Script/BlueprintGraph.K2Node_CustomEvent Name="K2Node_CustomEvent_0" ExportPath="/Script/BlueprintGraph.K2Node_CustomEvent'/Game/Examples/BallShooter/Blueprints/BallShooterEnvironment.BallShooterEnvironment:EventGraph.K2Node_CustomEvent_0'"
@@ -49,5 +44,5 @@ test("Issue 27", async ({ blueprintPage }) => {
expect(await pin2A.evaluate(/** @param {PinElement} pin */ pin => pin.isLinked)).toBeTruthy()
expect(await pin2B.evaluate(/** @param {PinElement} pin */ pin => pin.isLinked)).toBeTruthy()
expect(await pin3.evaluate(/** @param {PinElement} pin */ pin => pin.isLinked)).toBeTruthy()
expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(2)
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(2)
})

77
tests/issue30.spec.js Executable file
View File

@@ -0,0 +1,77 @@
import { expect, test } from "./fixtures/test.js"
test("Issue 30", async ({ blueprintPage }) => {
await blueprintPage.paste(String.raw`
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_0" ExportPath="/Script/BlueprintGraph.K2Node_CallFunction'/Game/Examples/Tag/Blueprints/DirectionDistanceObserver.DirectionDistanceObserver:GetObservationSpace.K2Node_CallFunction_0'"
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/Engine.KismetSystemLibrary'",MemberName="PrintString")
NodePosX=-80
NodePosY=432
AdvancedPinDisplay=Hidden
EnabledState=DevelopmentOnly
NodeGuid=9A00337641B5EA70E4FFE18C1C414F32
CustomProperties Pin (PinId=027475B440412F3ED9BA1E83CAC84E24,PinName="execute",PinToolTip="\nExec",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=6F39E27148B1DA550F87698348335460,PinName="then",PinToolTip="\nExec",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_Knot_5 47E4D9AF4CD414564F484A96E876E80B,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=EBCBA976448F8FF2C37253BE195D82E3,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nKismet System Library Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/Engine.KismetSystemLibrary'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultObject="/Script/Engine.Default__KismetSystemLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=2C16481F475AD64490F9329556C21413,PinName="WorldContextObject",PinToolTip="World Context Object\nObject Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/CoreUObject.Object'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=F0BAB035430EAEF7A48A43828AEB3E2D,PinName="InString",PinToolTip="In String\nString\n\nThe string to log out",PinType.PinCategory="string",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="Hello",AutogeneratedDefaultValue="Hello",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=E5E4988B4D6A9664835EB19D003E37CA,PinName="bPrintToScreen",PinToolTip="Print to Screen\nBoolean\n\nWhether or not to print the output to the screen",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="true",AutogeneratedDefaultValue="true",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
CustomProperties Pin (PinId=8E634AAA4701C20D0EE82E9A72A5F071,PinName="bPrintToLog",PinToolTip="Print to Log\nBoolean\n\nWhether or not to print the output to the log",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="true",AutogeneratedDefaultValue="true",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
CustomProperties Pin (PinId=A860B2DA4DBF4545E236CFB0E0A8C8D5,PinName="TextColor",PinToolTip="Text Color\nLinear Color Structure\n\nThe color of the text to display",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/CoreUObject.LinearColor'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="(R=0.000000,G=0.660000,B=1.000000,A=1.000000)",AutogeneratedDefaultValue="(R=0.000000,G=0.660000,B=1.000000,A=1.000000)",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
CustomProperties Pin (PinId=5CF65F3345D9DAF678A27EACC77F4BF5,PinName="Duration",PinToolTip="Duration\nFloat (single-precision)\n\nThe display duration (if Print to Screen is True). Using negative number will result in loading the duration time from the config.",PinType.PinCategory="real",PinType.PinSubCategory="float",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="2.000000",AutogeneratedDefaultValue="2.000000",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
CustomProperties Pin (PinId=F8B700114CF895EB52E8B4982E27B65C,PinName="Key",PinToolTip="Key\nName\n\nIf a non-empty key is provided, the message will replace any existing on-screen messages with the same key.",PinType.PinCategory="name",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="None",AutogeneratedDefaultValue="None",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_1" ExportPath="/Script/BlueprintGraph.K2Node_CallFunction'/Game/Examples/Tag/Blueprints/DirectionDistanceObserver.DirectionDistanceObserver:GetObservationSpace.K2Node_CallFunction_1'"
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/Engine.KismetSystemLibrary'",MemberName="PrintString")
NodePosX=-80
NodePosY=704
AdvancedPinDisplay=Hidden
EnabledState=DevelopmentOnly
NodeGuid=61813BD748DC08CE06DF61ACEDEEE7FD
CustomProperties Pin (PinId=1CE2683A40DD5093C0C60D83B16C279B,PinName="execute",PinToolTip="\nExec",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_Knot_6 CD2263A441CA4DB45102D398CF8E35E2,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=EC3D9FD140EFE18A5B83468AD0276CB3,PinName="then",PinToolTip="\nExec",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_FunctionResult_1 373D59B7461DB2BD153114A9017706CD,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=2F02C21347711064246408A63D92C6F7,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nKismet System Library Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/Engine.KismetSystemLibrary'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultObject="/Script/Engine.Default__KismetSystemLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=AD1E058B433611FD73ADB5AAC442B8DC,PinName="WorldContextObject",PinToolTip="World Context Object\nObject Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/CoreUObject.Object'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=E3B9CCB74D46795E3F76909A3EEE3F8A,PinName="InString",PinToolTip="In String\nString\n\nThe string to log out",PinType.PinCategory="string",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="Hello",AutogeneratedDefaultValue="Hello",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=8CBDC21E4341197389703D97DB9AE47A,PinName="bPrintToScreen",PinToolTip="Print to Screen\nBoolean\n\nWhether or not to print the output to the screen",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="true",AutogeneratedDefaultValue="true",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
CustomProperties Pin (PinId=8552348840FCE798A65C35B3B601A8F5,PinName="bPrintToLog",PinToolTip="Print to Log\nBoolean\n\nWhether or not to print the output to the log",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="true",AutogeneratedDefaultValue="true",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
CustomProperties Pin (PinId=46156236498D3CEFD7B0199EC535EC64,PinName="TextColor",PinToolTip="Text Color\nLinear Color Structure\n\nThe color of the text to display",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/CoreUObject.LinearColor'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="(R=0.000000,G=0.660000,B=1.000000,A=1.000000)",AutogeneratedDefaultValue="(R=0.000000,G=0.660000,B=1.000000,A=1.000000)",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
CustomProperties Pin (PinId=3FFC0B5B4C9E8F775FF67880828C8933,PinName="Duration",PinToolTip="Duration\nFloat (single-precision)\n\nThe display duration (if Print to Screen is True). Using negative number will result in loading the duration time from the config.",PinType.PinCategory="real",PinType.PinSubCategory="float",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="2.000000",AutogeneratedDefaultValue="2.000000",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
CustomProperties Pin (PinId=2FC1E9D4457421EF3D9B09A68C21FF6C,PinName="Key",PinToolTip="Key\nName\n\nIf a non-empty key is provided, the message will replace any existing on-screen messages with the same key.",PinType.PinCategory="name",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="None",AutogeneratedDefaultValue="None",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/BlueprintGraph.K2Node_FunctionResult Name="K2Node_FunctionResult_1" ExportPath="/Script/BlueprintGraph.K2Node_FunctionResult'/Game/Examples/Tag/Blueprints/DirectionDistanceObserver.DirectionDistanceObserver:GetObservationSpace.K2Node_FunctionResult_1'"
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/Schola.BlueprintBoxObserver'",MemberName="GetObservationSpace")
NodePosX=320
NodePosY=640
NodeGuid=05D14D3E43A0FB954FE600B0911EB455
CustomProperties Pin (PinId=373D59B7461DB2BD153114A9017706CD,PinName="execute",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_CallFunction_1 EC3D9FD140EFE18A5B83468AD0276CB3,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=DCF180B6411FB3C5474BFB9A3FDC548C,PinName="ReturnValue",PinToolTip="Return Value\nBox Space Structure\n\nGet Observation Space",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/Schola.BoxSpace'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/BlueprintGraph.K2Node_Knot Name="K2Node_Knot_5" ExportPath="/Script/BlueprintGraph.K2Node_Knot'/Game/Examples/Tag/Blueprints/DirectionDistanceObserver.DirectionDistanceObserver:GetObservationSpace.K2Node_Knot_5'"
NodePosX=80
NodePosY=640
NodeGuid=E8BC1D254BC44CC5E7076388BC697D41
CustomProperties Pin (PinId=47E4D9AF4CD414564F484A96E876E80B,PinName="InputPin",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_CallFunction_0 6F39E27148B1DA550F87698348335460,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=True,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=009095D54E2C15EBBB57DC9098EC7D8B,PinName="OutputPin",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_Knot_6 181E50FF4676A93FC497E0BF4873BCC2,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/BlueprintGraph.K2Node_Knot Name="K2Node_Knot_6" ExportPath="/Script/BlueprintGraph.K2Node_Knot'/Game/Examples/Tag/Blueprints/DirectionDistanceObserver.DirectionDistanceObserver:GetObservationSpace.K2Node_Knot_6'"
NodePosX=-80
NodePosY=640
NodeGuid=B7FC178E4D2E3929CE40AEB1462DC0BB
CustomProperties Pin (PinId=181E50FF4676A93FC497E0BF4873BCC2,PinName="InputPin",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_Knot_5 009095D54E2C15EBBB57DC9098EC7D8B,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=True,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=CD2263A441CA4DB45102D398CF8E35E2,PinName="OutputPin",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_CallFunction_1 1CE2683A40DD5093C0C60D83B16C279B,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
`)
await expect(blueprintPage.blueprintLocator.locator("ueb-node")).toHaveCount(5)
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(4)
expect(blueprintPage.blueprintLocator.evaluate(blueprint =>
/** @type {KnotNodeTemplate} */(
/** @type {NodeElement} */(blueprint.querySelectorAll("ueb-node")[3]).template
).switchDirectionsVisually
)).toBeTruthy()
expect(blueprintPage.blueprintLocator.evaluate(blueprint =>
/** @type {KnotNodeTemplate} */(
/** @type {NodeElement} */(blueprint.querySelectorAll("ueb-node")[4]).template
).switchDirectionsVisually
)).toBeTruthy()
})

View File

@@ -60,7 +60,7 @@ test.describe("Linking", () => {
await mouse.down()
await mouse.move(aRect.left + aRect.width + 100, aRect.top + aRect.height + 100, { steps: 4 })
// There is one link element ...
expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(1)
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(1)
// ... but no pins are linked yet
expect(await aPin.evaluate(pin => pin.entity.isLinked())).toBeFalsy()
expect(await bPin.evaluate(pin => pin.entity.isLinked())).toBeFalsy()