mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-01 04:04:43 +08:00
Compare commits
8 Commits
74edd2b9d8
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a68b2863c | ||
|
|
9c0e172630 | ||
|
|
fb7fc9fc66 | ||
|
|
5ef585eb34 | ||
|
|
db53d20762 | ||
|
|
d1cd8d4b3e | ||
|
|
c4911fe583 | ||
|
|
6ba2705386 |
@@ -47,20 +47,28 @@ And refresh the HTML page possibly holding `Shift`.
|
||||
There are a few concepts that must be assimilated in order to understand the design. Those concepts are in general each mapped into a subfolder in `js/`.
|
||||
|
||||
### Entity
|
||||
An Entity is just a data holder object that does not really do anything by itself, it has a purely information storage related purpose. The top class at the hierarchy of entities is `IEntity`. It is responsible for the initialization of the entity in its constructor according to the information contained in the object provided as an argument or from the attributes static field. This ended up being a somewhat wacky runtime type system. Each subclass can specify its attributes in the form of a static member variable of type vanilla object where each entry is a subclass of IEntity. The entities moreover are responsible for their serialization and deserialization: each class has a `serialize()` method and a `grammar` attribute to parse entities.
|
||||
An **Entity** is a simple object that only stores data, it doesn’t perform any actions. The base class for all entities is `IEntity`. Its main job is to initialize an entity using data from an input object or a predefined attributes field. This setup has resulted in a somewhat unconventional runtime type system. Each subclass of `IEntity` defines its `attributes` as a object static field, where each entry represents another `IEntity` subclass (class object, not instance). Additionally, entities handle their own serialization and deserialization using the `serialize()` method and a `grammar` attribute, which parses entity data from the blueprint code.
|
||||
|
||||
### Element
|
||||
Each element is just a custom HTML element type and its tag name is defined in the class file. The top level of the hierarchy is `IElement` and it inherits from `LitElement`. This class can be thought as an association between an entity and a template (and those are the arguments of the constructor). The top class `IElement` does propagate the lifecycle provided by `LitElement` to the template so that a template can hook into it.
|
||||
An **Element** is a custom HTML element, with its tag name defined in the class file. At the top of the hierarchy is `IElement`, which extends `LitElement`. You can think of `IElement` as a bridge between an *Entity* and a *Template*, these are passed as arguments to its constructor. Moreover, `IElement` ensures that the lifecycle events provided by `LitElement` are passed down to the template, allowing the template to hook into them.
|
||||
|
||||
### Template
|
||||
When looking at the Lit documentation, it might be noticed that usually HTML templates are returned as part of the `render()` method of an Element. The problem with such approach is that it makes it hard to have very different templates and UI behavior for the same element in a natural way (by means of inheritance because a custom element cannot be mapped to multiple classes). Take for example a `<ueb-pin>` in a graph node, it may or may not have any input and if it has one, the input might be a checkbox, a vector or something completely different like a texture. For this reason the responsibility to render the HTML content is moved from the Element to the Template and inheritance is replaced with composition so that two same elements can have different templates.
|
||||
Templates do have access to the same lifecycle as elements have, this is implemented in the IElement class that calls, for each method in the lifecycle, the relative method in the template. Moreover the templates hierarchy can also introduce new behaviors that can be replaced by subclasses, one example of such is IInputPinTemplate.
|
||||
In Lit, HTML templates are typically returned from an element’s `render()` method. However, this approach makes it difficult to apply different templates and UI behaviors to the same element, since a custom element can only be associated with one class.
|
||||
For example, consider a `<ueb-pin>` element inside a graph node. It may or may not have an input, and if it does, the input type could be text, a checkbox, a vector. To handle this flexibility, rendering is moved from the *Element* to the *Template*. Instead of using inheritance (which is limiting), we use composition, allowing the same element to have different templates.
|
||||
|
||||
Templates have access to the same lifecycle methods as elements. This is achieved in `IElement`, which forwards lifecycle calls to the corresponding methods in the template. The template hierarchy can introduce new behaviors that subclasses can override. For example, `IInputPinTemplate` defines behaviors that can be customized by its subclasses.
|
||||
|
||||
### Input
|
||||
Classes used to map input events (generated from a mouse or a keyboard for example) to operations on the graph. They do model advanced user interaction (like mouse drag) that are originated by input JavaScript events. Simpler events (like click or focus), are implemented in the lit templates directly.
|
||||
These classes handle input events (such as mouse and keyboard interactions) and map them to operations on the graph. They support complex interactions, like dragging with the mouse, which originate from JavaScript input events. In contrast, simpler events such as click or focus are handled directly within Lit templates.
|
||||
|
||||
### Selection
|
||||
It contains just a few classes related exclusively to the operation of selecting nodes. It is an (arguably useless) attempt to optimize the selection in case of graphs with a very large numbers of nodes (it is not really usefull because in the case of many many nodes, the bootleneck becomes the DOM rendering, not deciding in JavaScript which nodes are selected and which are not even though this happens every frame). Selection has two models: one very simple that checks every frame all the nodes in the graph to see whether or not they are selected by the selector, and the fast model that attemps to optimize the number of nodes that are looked up at, much more complicated and not super usefull as stated before.
|
||||
This module contains a few classes focused solely on selecting nodes. It was originally designed to optimize selection for graphs with a very large number of nodes, but in practice, this optimization is of limited use. The real performance bottleneck in such cases is DOM rendering, not the JavaScript logic that determines which nodes are selected.
|
||||
There are two selection models:
|
||||
1. Simple Model: every frame, it checks all nodes in the graph to determine whether they are selected.
|
||||
2. Fast Model: uses a structured index of nodes to limit lookups, reducing the need to scan the entire graph.
|
||||
|
||||
### Decoding
|
||||
This handles blueprint interpretation, defining node *Template* classes, colors, icons, and other attributes like the title of a node.
|
||||
|
||||
## Code Style
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
A stand alone implementation of the UE's Blueprint visual language editor
|
||||
|
||||
https://github.com/barsdeveloper/ueblueprint ⭐
|
||||
|
||||
https://www.npmjs.com/package/ueblueprint
|
||||
|
||||
## Features:
|
||||
@@ -50,7 +52,11 @@ You can check `index.html` for a working example, the main steps are the followi
|
||||
</script>
|
||||
```
|
||||
5. Define your blueprint by writing the code inside a `template`, inside a `ueb-blueprint` element.
|
||||
It can have light background using the following CSS class: `<ueb-blueprint class="ueb-light-mode">`
|
||||
Configuration:
|
||||
- Height: `<ueb-blueprint style="--ueb-height: 500px">`
|
||||
- Light mode: `<ueb-blueprint class="ueb-light-mode">`
|
||||
- Initial zoom: `<ueb-blueprint data-zoom="-4">`
|
||||
- Graph type: `<ueb-blueprint data-type="MATERIAL FUNCTION">`
|
||||
```HTML
|
||||
<ueb-blueprint>
|
||||
<template>
|
||||
|
||||
28
debug.html
28
debug.html
@@ -2,23 +2,23 @@
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>UE Blueprint</title>
|
||||
<link rel="stylesheet" href="dist/css/ueb-style.css">
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
--ueb-height: 100vh;
|
||||
}
|
||||
</style>
|
||||
<meta charset="utf-8" />
|
||||
<title>UE Blueprint</title>
|
||||
<link rel="stylesheet" href="dist/css/ueb-style.css">
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
--ueb-height: 100vh;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script type="module">
|
||||
import { Blueprint } from "./dist/ueblueprint.js"
|
||||
</script>
|
||||
<ueb-blueprint></ueb-blueprint>
|
||||
<script type="module">
|
||||
import { Blueprint } from "./dist/ueblueprint.js"
|
||||
</script>
|
||||
<ueb-blueprint></ueb-blueprint>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
25
dist/css/ueb-style.css
vendored
25
dist/css/ueb-style.css
vendored
@@ -68,6 +68,18 @@ ueb-blueprint svg {
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
.ueb-viewport-type {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 5px;
|
||||
font-size: 60px;
|
||||
font-weight: 900;
|
||||
color: rgba(128, 128, 128, 0.2509803922);
|
||||
font-stretch: condensed;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.ueb-viewport-body {
|
||||
position: relative;
|
||||
height: var(--ueb-height, 30rem);
|
||||
@@ -781,6 +793,19 @@ ueb-blueprint[data-scrolling=false][data-selecting=false] .ueb-pin-wrapper:hover
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
.ueb-pin-required-mark {
|
||||
width: 0;
|
||||
}
|
||||
.ueb-pin-required-mark::before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 6px;
|
||||
height: 4px;
|
||||
background: var(--ueb-pin-color);
|
||||
margin-left: -13px;
|
||||
border-radius: 0 2px 2px 0;
|
||||
}
|
||||
|
||||
.ueb-pin-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
2
dist/css/ueb-style.css.map
vendored
2
dist/css/ueb-style.css.map
vendored
File diff suppressed because one or more lines are too long
2
dist/css/ueb-style.min.css
vendored
2
dist/css/ueb-style.min.css
vendored
File diff suppressed because one or more lines are too long
2
dist/css/ueb-style.min.css.map
vendored
2
dist/css/ueb-style.min.css.map
vendored
File diff suppressed because one or more lines are too long
117
dist/ueblueprint.js
vendored
117
dist/ueblueprint.js
vendored
@@ -230,6 +230,8 @@ class Configuration {
|
||||
select: "/Script/BlueprintGraph.K2Node_Select",
|
||||
self: "/Script/BlueprintGraph.K2Node_Self",
|
||||
slateBlueprintLibrary: "/Script/UMG.SlateBlueprintLibrary",
|
||||
soundCueGraphNode: "/Script/AudioEditor.SoundCueGraphNode",
|
||||
soundNodeWavePlayer: "/Script/Engine.SoundNodeWavePlayer",
|
||||
spawnActorFromClass: "/Script/BlueprintGraph.K2Node_SpawnActorFromClass",
|
||||
switchEnum: "/Script/BlueprintGraph.K2Node_SwitchEnum",
|
||||
switchGameplayTag: "/Script/GameplayTagsEditor.GameplayTagsK2Node_SwitchGameplayTag",
|
||||
@@ -4273,6 +4275,13 @@ function nodeTitle(entity) {
|
||||
return "Input"
|
||||
case p$6.pcgEditorGraphNodeOutput:
|
||||
return "Output"
|
||||
case p$6.soundNodeWavePlayer:
|
||||
return `Wave Player : ${entity.getSounCueSubobject()
|
||||
?.SoundWaveAssetPtr
|
||||
?.type
|
||||
.match(/([^.]+)$/)
|
||||
?.[0]
|
||||
?? "NONE"}`
|
||||
case p$6.spawnActorFromClass:
|
||||
let className = entity.getCustomproperties()
|
||||
.find(pinEntity => pinEntity.PinName.toString() == "ReturnValue")
|
||||
@@ -4328,6 +4337,10 @@ function nodeTitle(entity) {
|
||||
let result = pcgSubobject.NodeTitle ? pcgSubobject.NodeTitle.toString() : nodeTitle(pcgSubobject);
|
||||
return result
|
||||
}
|
||||
const soundCueSubobject = entity.getSounCueSubobject();
|
||||
if (soundCueSubobject) {
|
||||
return Utility.formatStringName(soundCueSubobject.getObjectName(true).replace(/^SoundNode/, ""))
|
||||
}
|
||||
const subgraphObject = entity.getSubgraphObject();
|
||||
if (subgraphObject) {
|
||||
return subgraphObject.Graph.getName()
|
||||
@@ -4520,7 +4533,7 @@ const p$5 = Configuration.paths;
|
||||
|
||||
/** @param {ObjectEntity} entity */
|
||||
function nodeIcon(entity) {
|
||||
if (entity.isMaterial() || entity.isPcg() || entity.isNiagara()) {
|
||||
if (entity.isMaterial() || entity.isPcg() || entity.isSoundCue() || entity.isNiagara()) {
|
||||
return null
|
||||
}
|
||||
switch (entity.getType()) {
|
||||
@@ -5884,13 +5897,9 @@ class PinEntity extends IEntity {
|
||||
}
|
||||
if (this.objectEntity?.isPcg()) {
|
||||
const pcgSuboject = this.objectEntity.getPcgSubobject();
|
||||
const pinObjectReference = this.isInput()
|
||||
? pcgSuboject.InputPins?.valueOf()[this.pinIndex]
|
||||
: pcgSuboject.OutputPins?.valueOf()[this.pinIndex];
|
||||
if (pinObjectReference) {
|
||||
/** @type {ObjectEntity} */
|
||||
const pinObject = pcgSuboject[Configuration.subObjectAttributeNameFromReference(pinObjectReference, true)];
|
||||
let allowedTypes = pinObject.Properties?.AllowedTypes?.toString() ?? "";
|
||||
const pinObject = this.getPinObject(pcgSuboject);
|
||||
if (pinObject) {
|
||||
let allowedTypes = pinObject["Properties"]?.AllowedTypes?.toString() ?? "";
|
||||
if (allowedTypes == "") {
|
||||
allowedTypes = this.PinType.PinCategory ?? "";
|
||||
if (allowedTypes == "") {
|
||||
@@ -5899,8 +5908,8 @@ class PinEntity extends IEntity {
|
||||
}
|
||||
if (allowedTypes) {
|
||||
if (
|
||||
pinObject.Properties.bAllowMultipleData?.valueOf() !== false
|
||||
&& pinObject.Properties.bAllowMultipleConnections?.valueOf() !== false
|
||||
pinObject["Properties"].bAllowMultipleData?.valueOf() !== false
|
||||
&& pinObject["Properties"].bAllowMultipleConnections?.valueOf() !== false
|
||||
) {
|
||||
allowedTypes += "[]";
|
||||
}
|
||||
@@ -6017,6 +6026,17 @@ class PinEntity extends IEntity {
|
||||
return false
|
||||
}
|
||||
|
||||
/** @param {ObjectEntity} pcgSuboject */
|
||||
getPinObject(pcgSuboject) {
|
||||
const pinObjectReference = this.isInput()
|
||||
? pcgSuboject.InputPins?.valueOf()[this.pinIndex]
|
||||
: pcgSuboject.OutputPins?.valueOf()[this.pinIndex];
|
||||
if (pinObjectReference) {
|
||||
/** @type {ObjectEntity} */
|
||||
return pcgSuboject[Configuration.subObjectAttributeNameFromReference(pinObjectReference, true)]
|
||||
}
|
||||
}
|
||||
|
||||
getSubCategory() {
|
||||
return this.PinType.PinSubCategoryObject?.path
|
||||
}
|
||||
@@ -6402,6 +6422,8 @@ class ObjectEntity extends IEntity {
|
||||
PositionY: MirroredEntity.of(IntegerEntity),
|
||||
SettingsInterface: ObjectReferenceEntity,
|
||||
PCGNode: ObjectReferenceEntity,
|
||||
SoundNode: ObjectReferenceEntity,
|
||||
SoundWaveAssetPtr: ObjectReferenceEntity,
|
||||
HiGenGridSize: SymbolEntity,
|
||||
Operation: SymbolEntity,
|
||||
NodePosX: IntegerEntity,
|
||||
@@ -6546,6 +6568,8 @@ class ObjectEntity extends IEntity {
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.OutputPins>} */ this.OutputPins;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.ParameterName>} */ this.ParameterName;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PCGNode>} */ this.PCGNode;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.SoundNode>} */ this.SoundNode;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.SoundWaveAssetPtr>} */ this.SoundWaveAssetPtr;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PinNames>} */ this.PinNames;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PinTags>} */ this.PinTags;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PositionX>} */ this.PositionX;
|
||||
@@ -6761,6 +6785,10 @@ class ObjectEntity extends IEntity {
|
||||
if (this.MaterialExpression) {
|
||||
return this.MaterialExpression.type
|
||||
}
|
||||
let subobject = this.getSounCueSubobject();
|
||||
if (subobject) {
|
||||
return subobject.getClass()
|
||||
}
|
||||
return this.getClass()
|
||||
}
|
||||
|
||||
@@ -6894,14 +6922,33 @@ class ObjectEntity extends IEntity {
|
||||
}
|
||||
|
||||
isPcg() {
|
||||
return this.getClass() === Configuration.paths.pcgEditorGraphNode
|
||||
|| this.getPcgSubobject() != null
|
||||
return this.getClass() == Configuration.paths.pcgEditorGraphNode || this.getPcgSubobject() != null
|
||||
}
|
||||
|
||||
isNiagara() {
|
||||
return this.Class && (this.Class.type ? this.Class.type : this.Class.path)?.startsWith("/Script/NiagaraEditor.")
|
||||
}
|
||||
|
||||
isSoundCue() {
|
||||
return this.getClass() == Configuration.paths.soundCueGraphNode
|
||||
}
|
||||
|
||||
getBlueprintType() {
|
||||
if (this.isMaterial()) {
|
||||
return "MATERIAL"
|
||||
}
|
||||
if (this.isNiagara()) {
|
||||
return "NIAGARA"
|
||||
}
|
||||
if (this.isPcg()) {
|
||||
return "PCG Graph"
|
||||
}
|
||||
if (this.isSoundCue()) {
|
||||
return "SOUND CUE"
|
||||
}
|
||||
return "BLUEPRINT"
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
getPcgSubobject() {
|
||||
const node = this.PCGNode;
|
||||
@@ -6910,6 +6957,14 @@ class ObjectEntity extends IEntity {
|
||||
: null
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
getSounCueSubobject() {
|
||||
const node = this.SoundNode;
|
||||
return node
|
||||
? this[Configuration.subObjectAttributeNameFromReference(node, true)]
|
||||
: null
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
getSettingsObject() {
|
||||
const settings = this.SettingsInterface;
|
||||
@@ -7671,6 +7726,8 @@ class LinkTemplate extends IFromToPositionedTemplate {
|
||||
this.blueprint.addGraphElement(knot); // Important: keep it before changing existing links
|
||||
const inputPin = this.element.getInputPin();
|
||||
const outputPin = this.element.getOutputPin();
|
||||
this.element.origin = null;
|
||||
this.element.target = null;
|
||||
const link = /** @type {LinkElementConstructor} */(ElementFactory.getConstructor("ueb-link"))
|
||||
.newObject(outputPin, knotTemplate.inputPin);
|
||||
this.blueprint.addGraphElement(link);
|
||||
@@ -7689,9 +7746,9 @@ class LinkTemplate extends IFromToPositionedTemplate {
|
||||
|
||||
// Switch actual input/output pins if allowed and makes sense
|
||||
if (isOriginAKnot && !targetPin) {
|
||||
if (originPin?.isInputLoosely() && to > from + Configuration.distanceThreshold) {
|
||||
if (originPin?.isInput() && to > from + Configuration.distanceThreshold) {
|
||||
this.element.origin = /** @type {KnotPinTemplate} */(originPin.template).getoppositePin();
|
||||
} else if (originPin?.isOutputLoosely() && to < from - Configuration.distanceThreshold) {
|
||||
} else if (originPin?.isOutput() && to < from - Configuration.distanceThreshold) {
|
||||
this.element.origin = /** @type {KnotPinTemplate} */(originPin.template).getoppositePin();
|
||||
}
|
||||
}
|
||||
@@ -9609,8 +9666,12 @@ class PinTemplate extends ITemplate {
|
||||
${this.isInputRendered() ? this.renderInput() : x``}
|
||||
</div>
|
||||
`;
|
||||
let pcgSubobject = this.element.nodeElement.entity.getPcgSubobject();
|
||||
return x`
|
||||
<div class="ueb-pin-wrapper">
|
||||
${pcgSubobject && this.element.entity.getPinObject(pcgSubobject)?.["Properties"]?.["PinStatus"] == "Required"
|
||||
? x`<div class="ueb-pin-required-mark"></div>`
|
||||
: E}
|
||||
${this.element.isInput() ? x`${icon}${content}` : x`${content}${icon}`}
|
||||
</div>
|
||||
`
|
||||
@@ -9645,13 +9706,13 @@ class PinTemplate extends ITemplate {
|
||||
case "Set": return SVGIcon.setPin
|
||||
case "Map": return SVGIcon.mapPin
|
||||
}
|
||||
if (this.element.entity.PinType.PinCategory?.toString().toLocaleLowerCase() === "delegate") {
|
||||
if (this.element.entity.PinType.PinCategory?.toString().toLocaleLowerCase() == "delegate") {
|
||||
return SVGIcon.delegate
|
||||
}
|
||||
if (this.element.nodeElement?.template instanceof VariableOperationNodeTemplate) {
|
||||
return SVGIcon.operationPin
|
||||
}
|
||||
if (this.element.entity.PinType.PinCategory?.toString().toLocaleLowerCase() === "statictype") {
|
||||
if (this.element.entity.PinType.PinCategory?.toString().toLocaleLowerCase() == "statictype") {
|
||||
return SVGIcon.staticPin
|
||||
}
|
||||
return SVGIcon.genericPin
|
||||
@@ -11246,7 +11307,7 @@ class BlueprintTemplate extends ITemplate {
|
||||
Zoom ${this.blueprint.zoom == 0 ? "1:1" : (this.blueprint.zoom > 0 ? "+" : "") + this.blueprint.zoom}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ueb-viewport-overlay"></div>
|
||||
<div class="ueb-viewport-type">${this.blueprint.blueprintType}</div>
|
||||
<div class="ueb-viewport-body">
|
||||
<div class="ueb-grid"
|
||||
style="--ueb-additional-x: ${Math.round(this.blueprint.translateX)}; --ueb-additional-y: ${Math.round(this.blueprint.translateY)}; --ueb-translate-x: ${Math.round(this.blueprint.translateX)}; --ueb-translate-y: ${Math.round(this.blueprint.translateY)};">
|
||||
@@ -11419,6 +11480,11 @@ class BlueprintTemplate extends ITemplate {
|
||||
class Blueprint extends IElement {
|
||||
|
||||
static properties = {
|
||||
blueprintType: {
|
||||
type: String,
|
||||
attribute: "data-type",
|
||||
reflect: true,
|
||||
},
|
||||
selecting: {
|
||||
type: Boolean,
|
||||
attribute: "data-selecting",
|
||||
@@ -11495,6 +11561,7 @@ class Blueprint extends IElement {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.blueprintType = "";
|
||||
this.selecting = false;
|
||||
this.scrolling = false;
|
||||
this.focused = false;
|
||||
@@ -11795,17 +11862,17 @@ class Blueprint extends IElement {
|
||||
const removeEventHandler = event => {
|
||||
const target = event.currentTarget;
|
||||
target.removeEventListener(Configuration.removeEventName, removeEventHandler);
|
||||
const [graphElementsArray, entity] = target instanceof NodeElement
|
||||
const [container, entity] = target instanceof NodeElement
|
||||
? [this.nodes, target.entity]
|
||||
: target instanceof LinkElement
|
||||
? [this.links]
|
||||
: null;
|
||||
// @ts-expect-error
|
||||
const index = graphElementsArray?.indexOf(target);
|
||||
const index = container?.indexOf(target);
|
||||
if (index >= 0) {
|
||||
const last = graphElementsArray.pop();
|
||||
if (index < graphElementsArray.length) {
|
||||
graphElementsArray[index] = last;
|
||||
const last = container.pop();
|
||||
if (index < container.length) {
|
||||
container[index] = last;
|
||||
}
|
||||
}
|
||||
if (entity) {
|
||||
@@ -11836,6 +11903,9 @@ class Blueprint extends IElement {
|
||||
this.entity.addObjectEntity(element.entity);
|
||||
element.addEventListener(Configuration.removeEventName, removeEventHandler);
|
||||
this.template.nodesContainerElement?.appendChild(element);
|
||||
if (!this.blueprintType) {
|
||||
this.blueprintType = element.entity.getBlueprintType();
|
||||
}
|
||||
} else if (element instanceof LinkElement && !this.links.includes(element)) {
|
||||
this.links.push(element);
|
||||
element.addEventListener(Configuration.removeEventName, removeEventHandler);
|
||||
@@ -11862,6 +11932,9 @@ class Blueprint extends IElement {
|
||||
}
|
||||
element.remove();
|
||||
}
|
||||
if (this.nodes.length == 0) {
|
||||
this.blueprintType = "";
|
||||
}
|
||||
}
|
||||
|
||||
setFocused(value = true) {
|
||||
|
||||
8
dist/ueblueprint.min.js
vendored
8
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -12,6 +12,11 @@ import BlueprintTemplate from "./template/BlueprintTemplate.js"
|
||||
export default class Blueprint extends IElement {
|
||||
|
||||
static properties = {
|
||||
blueprintType: {
|
||||
type: String,
|
||||
attribute: "data-type",
|
||||
reflect: true,
|
||||
},
|
||||
selecting: {
|
||||
type: Boolean,
|
||||
attribute: "data-selecting",
|
||||
@@ -88,6 +93,7 @@ export default class Blueprint extends IElement {
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
this.blueprintType = ""
|
||||
this.selecting = false
|
||||
this.scrolling = false
|
||||
this.focused = false
|
||||
@@ -388,17 +394,17 @@ export default class Blueprint extends IElement {
|
||||
const removeEventHandler = event => {
|
||||
const target = event.currentTarget
|
||||
target.removeEventListener(Configuration.removeEventName, removeEventHandler)
|
||||
const [graphElementsArray, entity] = target instanceof NodeElement
|
||||
const [container, entity] = target instanceof NodeElement
|
||||
? [this.nodes, target.entity]
|
||||
: target instanceof LinkElement
|
||||
? [this.links]
|
||||
: null
|
||||
// @ts-expect-error
|
||||
const index = graphElementsArray?.indexOf(target)
|
||||
const index = container?.indexOf(target)
|
||||
if (index >= 0) {
|
||||
const last = graphElementsArray.pop()
|
||||
if (index < graphElementsArray.length) {
|
||||
graphElementsArray[index] = last
|
||||
const last = container.pop()
|
||||
if (index < container.length) {
|
||||
container[index] = last
|
||||
}
|
||||
}
|
||||
if (entity) {
|
||||
@@ -429,6 +435,9 @@ export default class Blueprint extends IElement {
|
||||
this.entity.addObjectEntity(element.entity)
|
||||
element.addEventListener(Configuration.removeEventName, removeEventHandler)
|
||||
this.template.nodesContainerElement?.appendChild(element)
|
||||
if (!this.blueprintType) {
|
||||
this.blueprintType = element.entity.getBlueprintType()
|
||||
}
|
||||
} else if (element instanceof LinkElement && !this.links.includes(element)) {
|
||||
this.links.push(element)
|
||||
element.addEventListener(Configuration.removeEventName, removeEventHandler)
|
||||
@@ -455,6 +464,9 @@ export default class Blueprint extends IElement {
|
||||
}
|
||||
element.remove()
|
||||
}
|
||||
if (this.nodes.length == 0) {
|
||||
this.blueprintType = ""
|
||||
}
|
||||
}
|
||||
|
||||
setFocused(value = true) {
|
||||
|
||||
@@ -206,6 +206,8 @@ export default class Configuration {
|
||||
select: "/Script/BlueprintGraph.K2Node_Select",
|
||||
self: "/Script/BlueprintGraph.K2Node_Self",
|
||||
slateBlueprintLibrary: "/Script/UMG.SlateBlueprintLibrary",
|
||||
soundCueGraphNode: "/Script/AudioEditor.SoundCueGraphNode",
|
||||
soundNodeWavePlayer: "/Script/Engine.SoundNodeWavePlayer",
|
||||
spawnActorFromClass: "/Script/BlueprintGraph.K2Node_SpawnActorFromClass",
|
||||
switchEnum: "/Script/BlueprintGraph.K2Node_SwitchEnum",
|
||||
switchGameplayTag: "/Script/GameplayTagsEditor.GameplayTagsK2Node_SwitchGameplayTag",
|
||||
|
||||
@@ -6,7 +6,7 @@ const p = Configuration.paths
|
||||
|
||||
/** @param {ObjectEntity} entity */
|
||||
export default function nodeIcon(entity) {
|
||||
if (entity.isMaterial() || entity.isPcg() || entity.isNiagara()) {
|
||||
if (entity.isMaterial() || entity.isPcg() || entity.isSoundCue() || entity.isNiagara()) {
|
||||
return null
|
||||
}
|
||||
switch (entity.getType()) {
|
||||
|
||||
@@ -268,6 +268,13 @@ export default function nodeTitle(entity) {
|
||||
return "Input"
|
||||
case p.pcgEditorGraphNodeOutput:
|
||||
return "Output"
|
||||
case p.soundNodeWavePlayer:
|
||||
return `Wave Player : ${entity.getSounCueSubobject()
|
||||
?.SoundWaveAssetPtr
|
||||
?.type
|
||||
.match(/([^.]+)$/)
|
||||
?.[0]
|
||||
?? "NONE"}`
|
||||
case p.spawnActorFromClass:
|
||||
let className = entity.getCustomproperties()
|
||||
.find(pinEntity => pinEntity.PinName.toString() == "ReturnValue")
|
||||
@@ -323,6 +330,10 @@ export default function nodeTitle(entity) {
|
||||
let result = pcgSubobject.NodeTitle ? pcgSubobject.NodeTitle.toString() : nodeTitle(pcgSubobject)
|
||||
return result
|
||||
}
|
||||
const soundCueSubobject = entity.getSounCueSubobject()
|
||||
if (soundCueSubobject) {
|
||||
return Utility.formatStringName(soundCueSubobject.getObjectName(true).replace(/^SoundNode/, ""))
|
||||
}
|
||||
const subgraphObject = entity.getSubgraphObject()
|
||||
if (subgraphObject) {
|
||||
return subgraphObject.Graph.getName()
|
||||
|
||||
@@ -119,6 +119,8 @@ export default class ObjectEntity extends IEntity {
|
||||
PositionY: MirroredEntity.of(IntegerEntity),
|
||||
SettingsInterface: ObjectReferenceEntity,
|
||||
PCGNode: ObjectReferenceEntity,
|
||||
SoundNode: ObjectReferenceEntity,
|
||||
SoundWaveAssetPtr: ObjectReferenceEntity,
|
||||
HiGenGridSize: SymbolEntity,
|
||||
Operation: SymbolEntity,
|
||||
NodePosX: IntegerEntity,
|
||||
@@ -263,6 +265,8 @@ export default class ObjectEntity extends IEntity {
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.OutputPins>} */ this.OutputPins
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.ParameterName>} */ this.ParameterName
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PCGNode>} */ this.PCGNode
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.SoundNode>} */ this.SoundNode
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.SoundWaveAssetPtr>} */ this.SoundWaveAssetPtr
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PinNames>} */ this.PinNames
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PinTags>} */ this.PinTags
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PositionX>} */ this.PositionX
|
||||
@@ -478,6 +482,10 @@ export default class ObjectEntity extends IEntity {
|
||||
if (this.MaterialExpression) {
|
||||
return this.MaterialExpression.type
|
||||
}
|
||||
let subobject = this.getSounCueSubobject()
|
||||
if (subobject) {
|
||||
return subobject.getClass()
|
||||
}
|
||||
return this.getClass()
|
||||
}
|
||||
|
||||
@@ -613,14 +621,33 @@ export default class ObjectEntity extends IEntity {
|
||||
}
|
||||
|
||||
isPcg() {
|
||||
return this.getClass() === Configuration.paths.pcgEditorGraphNode
|
||||
|| this.getPcgSubobject() != null
|
||||
return this.getClass() == Configuration.paths.pcgEditorGraphNode || this.getPcgSubobject() != null
|
||||
}
|
||||
|
||||
isNiagara() {
|
||||
return this.Class && (this.Class.type ? this.Class.type : this.Class.path)?.startsWith("/Script/NiagaraEditor.")
|
||||
}
|
||||
|
||||
isSoundCue() {
|
||||
return this.getClass() == Configuration.paths.soundCueGraphNode
|
||||
}
|
||||
|
||||
getBlueprintType() {
|
||||
if (this.isMaterial()) {
|
||||
return "MATERIAL"
|
||||
}
|
||||
if (this.isNiagara()) {
|
||||
return "NIAGARA"
|
||||
}
|
||||
if (this.isPcg()) {
|
||||
return "PCG Graph"
|
||||
}
|
||||
if (this.isSoundCue()) {
|
||||
return "SOUND CUE"
|
||||
}
|
||||
return "BLUEPRINT"
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
getPcgSubobject() {
|
||||
const node = this.PCGNode
|
||||
@@ -629,6 +656,14 @@ export default class ObjectEntity extends IEntity {
|
||||
: null
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
getSounCueSubobject() {
|
||||
const node = this.SoundNode
|
||||
return node
|
||||
? this[Configuration.subObjectAttributeNameFromReference(node, true)]
|
||||
: null
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
getSettingsObject() {
|
||||
const settings = this.SettingsInterface
|
||||
|
||||
@@ -186,13 +186,9 @@ export default class PinEntity extends IEntity {
|
||||
}
|
||||
if (this.objectEntity?.isPcg()) {
|
||||
const pcgSuboject = this.objectEntity.getPcgSubobject()
|
||||
const pinObjectReference = this.isInput()
|
||||
? pcgSuboject.InputPins?.valueOf()[this.pinIndex]
|
||||
: pcgSuboject.OutputPins?.valueOf()[this.pinIndex]
|
||||
if (pinObjectReference) {
|
||||
/** @type {ObjectEntity} */
|
||||
const pinObject = pcgSuboject[Configuration.subObjectAttributeNameFromReference(pinObjectReference, true)]
|
||||
let allowedTypes = pinObject.Properties?.AllowedTypes?.toString() ?? ""
|
||||
const pinObject = this.getPinObject(pcgSuboject)
|
||||
if (pinObject) {
|
||||
let allowedTypes = pinObject["Properties"]?.AllowedTypes?.toString() ?? ""
|
||||
if (allowedTypes == "") {
|
||||
allowedTypes = this.PinType.PinCategory ?? ""
|
||||
if (allowedTypes == "") {
|
||||
@@ -201,8 +197,8 @@ export default class PinEntity extends IEntity {
|
||||
}
|
||||
if (allowedTypes) {
|
||||
if (
|
||||
pinObject.Properties.bAllowMultipleData?.valueOf() !== false
|
||||
&& pinObject.Properties.bAllowMultipleConnections?.valueOf() !== false
|
||||
pinObject["Properties"].bAllowMultipleData?.valueOf() !== false
|
||||
&& pinObject["Properties"].bAllowMultipleConnections?.valueOf() !== false
|
||||
) {
|
||||
allowedTypes += "[]"
|
||||
}
|
||||
@@ -319,6 +315,17 @@ export default class PinEntity extends IEntity {
|
||||
return false
|
||||
}
|
||||
|
||||
/** @param {ObjectEntity} pcgSuboject */
|
||||
getPinObject(pcgSuboject) {
|
||||
const pinObjectReference = this.isInput()
|
||||
? pcgSuboject.InputPins?.valueOf()[this.pinIndex]
|
||||
: pcgSuboject.OutputPins?.valueOf()[this.pinIndex]
|
||||
if (pinObjectReference) {
|
||||
/** @type {ObjectEntity} */
|
||||
return pcgSuboject[Configuration.subObjectAttributeNameFromReference(pinObjectReference, true)]
|
||||
}
|
||||
}
|
||||
|
||||
getSubCategory() {
|
||||
return this.PinType.PinSubCategoryObject?.path
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ export default class BlueprintTemplate extends ITemplate {
|
||||
Zoom ${this.blueprint.zoom == 0 ? "1:1" : (this.blueprint.zoom > 0 ? "+" : "") + this.blueprint.zoom}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ueb-viewport-overlay"></div>
|
||||
<div class="ueb-viewport-type">${this.blueprint.blueprintType}</div>
|
||||
<div class="ueb-viewport-body">
|
||||
<div class="ueb-grid"
|
||||
style="--ueb-additional-x: ${Math.round(this.blueprint.translateX)}; --ueb-additional-y: ${Math.round(this.blueprint.translateY)}; --ueb-translate-x: ${Math.round(this.blueprint.translateX)}; --ueb-translate-y: ${Math.round(this.blueprint.translateY)};">
|
||||
|
||||
@@ -52,6 +52,8 @@ export default class LinkTemplate extends IFromToPositionedTemplate {
|
||||
this.blueprint.addGraphElement(knot) // Important: keep it before changing existing links
|
||||
const inputPin = this.element.getInputPin()
|
||||
const outputPin = this.element.getOutputPin()
|
||||
this.element.origin = null
|
||||
this.element.target = null
|
||||
const link = /** @type {LinkElementConstructor} */(ElementFactory.getConstructor("ueb-link"))
|
||||
.newObject(outputPin, knotTemplate.inputPin)
|
||||
this.blueprint.addGraphElement(link)
|
||||
@@ -70,9 +72,9 @@ export default class LinkTemplate extends IFromToPositionedTemplate {
|
||||
|
||||
// Switch actual input/output pins if allowed and makes sense
|
||||
if (isOriginAKnot && !targetPin) {
|
||||
if (originPin?.isInputLoosely() && to > from + Configuration.distanceThreshold) {
|
||||
if (originPin?.isInput() && to > from + Configuration.distanceThreshold) {
|
||||
this.element.origin = /** @type {KnotPinTemplate} */(originPin.template).getoppositePin()
|
||||
} else if (originPin?.isOutputLoosely() && to < from - Configuration.distanceThreshold) {
|
||||
} else if (originPin?.isOutput() && to < from - Configuration.distanceThreshold) {
|
||||
this.element.origin = /** @type {KnotPinTemplate} */(originPin.template).getoppositePin()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,8 +79,12 @@ export default class PinTemplate extends ITemplate {
|
||||
${this.isInputRendered() ? this.renderInput() : html``}
|
||||
</div>
|
||||
`
|
||||
let pcgSubobject = this.element.nodeElement.entity.getPcgSubobject()
|
||||
return html`
|
||||
<div class="ueb-pin-wrapper">
|
||||
${pcgSubobject && this.element.entity.getPinObject(pcgSubobject)?.["Properties"]?.["PinStatus"] == "Required"
|
||||
? html`<div class="ueb-pin-required-mark"></div>`
|
||||
: nothing}
|
||||
${this.element.isInput() ? html`${icon}${content}` : html`${content}${icon}`}
|
||||
</div>
|
||||
`
|
||||
@@ -115,13 +119,13 @@ export default class PinTemplate extends ITemplate {
|
||||
case "Set": return SVGIcon.setPin
|
||||
case "Map": return SVGIcon.mapPin
|
||||
}
|
||||
if (this.element.entity.PinType.PinCategory?.toString().toLocaleLowerCase() === "delegate") {
|
||||
if (this.element.entity.PinType.PinCategory?.toString().toLocaleLowerCase() == "delegate") {
|
||||
return SVGIcon.delegate
|
||||
}
|
||||
if (this.element.nodeElement?.template instanceof VariableOperationNodeTemplate) {
|
||||
return SVGIcon.operationPin
|
||||
}
|
||||
if (this.element.entity.PinType.PinCategory?.toString().toLocaleLowerCase() === "statictype") {
|
||||
if (this.element.entity.PinType.PinCategory?.toString().toLocaleLowerCase() == "statictype") {
|
||||
return SVGIcon.staticPin
|
||||
}
|
||||
return SVGIcon.genericPin
|
||||
|
||||
@@ -72,6 +72,18 @@ ueb-blueprint svg {
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
.ueb-viewport-type {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 5px;
|
||||
font-size: 60px;
|
||||
font-weight: 900;
|
||||
color: #80808040;
|
||||
font-stretch: condensed;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.ueb-viewport-body {
|
||||
position: relative;
|
||||
height: var(--ueb-height, 30rem);
|
||||
|
||||
@@ -67,6 +67,20 @@ ueb-blueprint[data-scrolling="false"][data-selecting="false"] .ueb-pin-wrapper:h
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
.ueb-pin-required-mark {
|
||||
width: 0;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 6px;
|
||||
height: 4px;
|
||||
background: var(--ueb-pin-color);
|
||||
margin-left: -13px;
|
||||
border-radius: 0 2px 2px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.ueb-pin-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
3
tests/fixtures/BlueprintFixture.js
vendored
3
tests/fixtures/BlueprintFixture.js
vendored
@@ -135,7 +135,7 @@ export default class BlueprintFixture {
|
||||
|
||||
/** @param {String} text */
|
||||
async paste(text) {
|
||||
return await this.#blueprintLocator.evaluate(
|
||||
await this.#blueprintLocator.evaluate(
|
||||
(blueprint, text) => {
|
||||
const event = new ClipboardEvent("paste", {
|
||||
bubbles: true,
|
||||
@@ -147,6 +147,7 @@ export default class BlueprintFixture {
|
||||
},
|
||||
text
|
||||
)
|
||||
await this.#blueprintLocator.evaluate(b => b.template.centerContentInViewport(false))
|
||||
}
|
||||
|
||||
async cleanup() {
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
import { expect, test } from "./fixtures/test.js"
|
||||
|
||||
test("Linking 2", async ({ blueprintPage }) => {
|
||||
const source = String.raw`
|
||||
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=816
|
||||
NodePosY=256
|
||||
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,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,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_7" ExportPath="/Script/BlueprintGraph.K2Node_Knot'/Game/Examples/Tag/Blueprints/DirectionDistanceObserver.DirectionDistanceObserver:GetObservationSpace.K2Node_Knot_7'"
|
||||
NodePosX=1088
|
||||
NodePosY=256
|
||||
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,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,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_8" ExportPath="/Script/BlueprintGraph.K2Node_Knot'/Game/Examples/Tag/Blueprints/DirectionDistanceObserver.DirectionDistanceObserver:GetObservationSpace.K2Node_Knot_8'"
|
||||
NodePosX=832
|
||||
NodePosY=448
|
||||
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,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,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=1088
|
||||
NodePosY=464
|
||||
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,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,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
End Object
|
||||
`
|
||||
await blueprintPage.paste(source)
|
||||
/** @type {(i: Number) => Locator<NodeElement>} */
|
||||
const getKnot = i => blueprintPage.blueprintLocator.locator("ueb-node").nth(i)
|
||||
const getRect = async i => await getKnot(i).evaluate(pin => pin.getBoundingClientRect())
|
||||
let rect = await getRect(0)
|
||||
const knotSize = [rect.width / 2, rect.height / 2]
|
||||
await blueprintPage.blueprintLocator.evaluate(b => b.template.centerContentInViewport(false))
|
||||
const mouse = blueprintPage.page.mouse
|
||||
const link = async (origin, target) => {
|
||||
await origin.hover()
|
||||
await mouse.down()
|
||||
await mouse.move(100, 100, { steps: 4 })
|
||||
await target.hover()
|
||||
await mouse.up()
|
||||
}
|
||||
|
||||
await expect(blueprintPage.blueprintLocator.locator("ueb-node")).toHaveCount(4)
|
||||
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(0)
|
||||
|
||||
let a = getKnot(0)
|
||||
let b = getKnot(1)
|
||||
await link(a, b)
|
||||
await expect(blueprintPage.blueprintLocator.locator("ueb-node")).toHaveCount(4)
|
||||
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(1)
|
||||
expect((await a.evaluate(n => /** @type {KnotNodeTemplate} */(n.template).inputPin.isLinked))).toBeFalsy()
|
||||
expect((await a.evaluate(n => /** @type {KnotNodeTemplate} */(n.template).outputPin.isLinked))).toBeTruthy()
|
||||
expect((await b.evaluate(n => /** @type {KnotNodeTemplate} */(n.template).inputPin.isLinked))).toBeTruthy()
|
||||
expect((await b.evaluate(n => /** @type {KnotNodeTemplate} */(n.template).outputPin.isLinked))).toBeFalsy()
|
||||
|
||||
a = getKnot(3)
|
||||
b = getKnot(2)
|
||||
await link(a, b)
|
||||
await expect(blueprintPage.blueprintLocator.locator("ueb-node")).toHaveCount(4)
|
||||
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(2)
|
||||
expect((await a.evaluate(n => /** @type {KnotNodeTemplate} */(n.template).inputPin.isLinked))).toBeTruthy()
|
||||
expect((await a.evaluate(n => /** @type {KnotNodeTemplate} */(n.template).outputPin.isLinked))).toBeFalsy()
|
||||
expect((await b.evaluate(n => /** @type {KnotNodeTemplate} */(n.template).inputPin.isLinked))).toBeFalsy()
|
||||
expect((await b.evaluate(n => /** @type {KnotNodeTemplate} */(n.template).outputPin.isLinked))).toBeTruthy()
|
||||
|
||||
a = getKnot(3)
|
||||
b = getKnot(0)
|
||||
await link(a, b)
|
||||
await expect(blueprintPage.blueprintLocator.locator("ueb-node")).toHaveCount(4)
|
||||
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(2)
|
||||
expect((await a.evaluate(n => /** @type {KnotNodeTemplate} */(n.template).inputPin.isLinked))).toBeTruthy()
|
||||
expect((await a.evaluate(n => /** @type {KnotNodeTemplate} */(n.template).outputPin.isLinked))).toBeFalsy()
|
||||
expect((await b.evaluate(n => /** @type {KnotNodeTemplate} */(n.template).inputPin.isLinked))).toBeFalsy()
|
||||
expect((await b.evaluate(n => /** @type {KnotNodeTemplate} */(n.template).outputPin.isLinked))).toBeTruthy()
|
||||
|
||||
})
|
||||
@@ -139,7 +139,6 @@ test("Linking 4", async ({ blueprintPage }) => {
|
||||
await expect(links).toHaveCount(0)
|
||||
|
||||
await blueprintPage.paste(source)
|
||||
await blueprintPage.blueprintLocator.evaluate(b => b.template.centerContentInViewport(false))
|
||||
|
||||
await expect(nodes).toHaveCount(7)
|
||||
await expect(knots).toHaveCount(2)
|
||||
|
||||
145
tests/linking5.spec.js
Executable file
145
tests/linking5.spec.js
Executable file
@@ -0,0 +1,145 @@
|
||||
import { expect, test } from "./fixtures/test.js"
|
||||
|
||||
test("Linking 4", async ({ blueprintPage }) => {
|
||||
const source = String.raw`
|
||||
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_3" ExportPath="/Script/BlueprintGraph.K2Node_CallFunction'/Game/NewWorld.NewWorld:PersistentLevel.NewWorld.EventGraph.K2Node_CallFunction_3'"
|
||||
bDefaultsToPureFunc=True
|
||||
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/Engine.KismetStringLibrary'",MemberName="GetSubstring")
|
||||
NodePosX=1008
|
||||
NodePosY=768
|
||||
NodeGuid=B2FABF17FC224539A22DD50BE7EBA741
|
||||
CustomProperties Pin (PinId=802A66FFB6024CEA959FFC5E870EAB78,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nKismet String Library Riferimento Oggetto",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/Engine.KismetStringLibrary'",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__KismetStringLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=9DF55E591CAF46C8A306BF721E17512B,PinName="SourceString",PinToolTip="Source String\nStringa\n\nLa stringa da cui ottenere la sottostringa",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,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=C7991C67B9684539BE69FD6AEB57A3D3,PinName="StartIndex",PinToolTip="Start Index\nNumero intero\n\nLa posizione in SourceString da usare come inizio della sottostringa",PinType.PinCategory="int",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="0",AutogeneratedDefaultValue="0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=450AD848644B43659895BD62E2C24403,PinName="Length",PinToolTip="Length\nNumero intero",PinType.PinCategory="int",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="1",AutogeneratedDefaultValue="1",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=996CEA8F0F344053A60E4E2E71E5887E,PinName="ReturnValue",PinToolTip="Return Value\nStringa\n\nLa sottostringa richiesta",Direction="EGPD_Output",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,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
End Object
|
||||
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_6" ExportPath="/Script/BlueprintGraph.K2Node_CallFunction'/Game/NewWorld.NewWorld:PersistentLevel.NewWorld.EventGraph.K2Node_CallFunction_6'"
|
||||
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/Engine.KismetSystemLibrary'",MemberName="PrintString")
|
||||
NodePosX=1680
|
||||
NodePosY=784
|
||||
AdvancedPinDisplay=Hidden
|
||||
EnabledState=DevelopmentOnly
|
||||
NodeGuid=13C498C8E48044B1AAE3133DFC430C72
|
||||
CustomProperties Pin (PinId=FD4ABF956144405B9D8B52F32E60A81C,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=FD66272595664EF989976A8ED35DEAC8,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,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=FA5ABD02AA6C4EF09A3108DCCE5BA48A,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nKismet System Library Riferimento Oggetto",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=D68062394615473DBBFC1AF10AC6C86A,PinName="WorldContextObject",PinToolTip="World Context Object\nRiferimento Oggetto",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=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=C3876F4BA9D542B3BBC5F4CA6C448DEE,PinName="InString",PinToolTip="In String\nStringa\n\nLa stringa per il logout",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=F3748CAC29C64B0CA361F0ECB33F99C8,PinName="bPrintToScreen",PinToolTip="Print to Screen\nBooleano\n\nDetermina se stampare o meno l\'output sullo schermo",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=037D5CB1F53342B8963E1F699D1AEC68,PinName="bPrintToLog",PinToolTip="Print to Log\nBooleano\n\nDetermina se stampare o meno l\'output nel registro",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=0414E030D6DC4C9BBE5AA69749929740,PinName="TextColor",PinToolTip="Text Color\nLinear Color Struttura\n\nIl colore del testo da visualizzare",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=CCC3403F01EC480DB025CF312C01BC1C,PinName="Duration",PinToolTip="Duration\nFloat (precisione singola)",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=402FBFE4EB6747AF8618A2AC16FD9FD0,PinName="Key",PinToolTip="Key\nNome",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_7" ExportPath="/Script/BlueprintGraph.K2Node_CallFunction'/Game/NewWorld.NewWorld:PersistentLevel.NewWorld.EventGraph.K2Node_CallFunction_7'"
|
||||
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/Engine.KismetSystemLibrary'",MemberName="PrintString")
|
||||
NodePosX=1680
|
||||
NodePosY=624
|
||||
AdvancedPinDisplay=Hidden
|
||||
EnabledState=DevelopmentOnly
|
||||
NodeGuid=19C0E5A417A24015A89474D383FF0984
|
||||
CustomProperties Pin (PinId=FD4ABF956144405B9D8B52F32E60A81C,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,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=FD66272595664EF989976A8ED35DEAC8,PinName="then",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,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=FA5ABD02AA6C4EF09A3108DCCE5BA48A,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),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=D68062394615473DBBFC1AF10AC6C86A,PinName="WorldContextObject",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=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=C3876F4BA9D542B3BBC5F4CA6C448DEE,PinName="InString",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=F3748CAC29C64B0CA361F0ECB33F99C8,PinName="bPrintToScreen",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=037D5CB1F53342B8963E1F699D1AEC68,PinName="bPrintToLog",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=0414E030D6DC4C9BBE5AA69749929740,PinName="TextColor",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=CCC3403F01EC480DB025CF312C01BC1C,PinName="Duration",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=402FBFE4EB6747AF8618A2AC16FD9FD0,PinName="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/NewWorld.NewWorld:PersistentLevel.NewWorld.EventGraph.K2Node_CallFunction_1'"
|
||||
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/Engine.KismetSystemLibrary'",MemberName="PrintString")
|
||||
NodePosX=1680
|
||||
NodePosY=464
|
||||
AdvancedPinDisplay=Hidden
|
||||
EnabledState=DevelopmentOnly
|
||||
NodeGuid=0419B08AA326489491FF7C61AB74DDF2
|
||||
CustomProperties Pin (PinId=FD4ABF956144405B9D8B52F32E60A81C,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,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=FD66272595664EF989976A8ED35DEAC8,PinName="then",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,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=FA5ABD02AA6C4EF09A3108DCCE5BA48A,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),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=D68062394615473DBBFC1AF10AC6C86A,PinName="WorldContextObject",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=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=C3876F4BA9D542B3BBC5F4CA6C448DEE,PinName="InString",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=F3748CAC29C64B0CA361F0ECB33F99C8,PinName="bPrintToScreen",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=037D5CB1F53342B8963E1F699D1AEC68,PinName="bPrintToLog",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=0414E030D6DC4C9BBE5AA69749929740,PinName="TextColor",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=CCC3403F01EC480DB025CF312C01BC1C,PinName="Duration",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=402FBFE4EB6747AF8618A2AC16FD9FD0,PinName="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
|
||||
`
|
||||
let blueprint = blueprintPage.blueprintLocator
|
||||
const nodes = blueprintPage.blueprintLocator.locator("ueb-node")
|
||||
const knots = blueprintPage.blueprintLocator.locator('ueb-node[data-type="/Script/BlueprintGraph.K2Node_Knot"]')
|
||||
const links = blueprintPage.blueprintLocator.locator("ueb-link")
|
||||
const returnValue = blueprint.locator('ueb-node:has-text("Get Substring") ueb-pin:has-text("Return Value")')
|
||||
const inString = blueprint.locator('ueb-node:has-text("Print String") ueb-pin:has-text("In String")')
|
||||
const mouse = blueprintPage.page.mouse
|
||||
const pinkColor = "251, 0, 208"
|
||||
|
||||
const link = async (origin, target) => {
|
||||
await origin.hover()
|
||||
await mouse.down()
|
||||
await mouse.move(100, 100, { steps: 4 })
|
||||
await target.hover()
|
||||
await mouse.up()
|
||||
}
|
||||
|
||||
await expect(nodes).toHaveCount(0)
|
||||
await expect(links).toHaveCount(0)
|
||||
|
||||
await blueprintPage.paste(source)
|
||||
|
||||
await expect(nodes).toHaveCount(4)
|
||||
await expect(links).toHaveCount(0)
|
||||
|
||||
await link(returnValue, inString.nth(0))
|
||||
await expect(nodes).toHaveCount(4)
|
||||
await expect(links).toHaveCount(1)
|
||||
|
||||
let linkRect = await links.first().evaluate(l => l.getBoundingClientRect())
|
||||
await mouse.dblclick(linkRect.x + linkRect.width / 2, linkRect.y + linkRect.height / 2)
|
||||
await expect(nodes).toHaveCount(5)
|
||||
await expect(links).toHaveCount(2)
|
||||
|
||||
await link(knots.last(), inString.nth(1))
|
||||
await expect(nodes).toHaveCount(5)
|
||||
await expect(links).toHaveCount(3)
|
||||
|
||||
linkRect = await links.first().evaluate(l => l.getBoundingClientRect())
|
||||
await mouse.dblclick(linkRect.x + linkRect.width / 2, linkRect.y + linkRect.height / 2)
|
||||
await expect(nodes).toHaveCount(6)
|
||||
await expect(links).toHaveCount(4)
|
||||
|
||||
await link(knots.last(), inString.nth(2))
|
||||
await expect(nodes).toHaveCount(6)
|
||||
await expect(links).toHaveCount(5)
|
||||
|
||||
// Remove knots (and links as a consequence) and link the "Return Value" to each "In String"
|
||||
|
||||
await knots.evaluateAll(knots => knots.forEach(k => k.remove()))
|
||||
await expect(nodes).toHaveCount(4)
|
||||
await expect(links).toHaveCount(0)
|
||||
|
||||
await link(returnValue, inString.nth(0))
|
||||
await link(returnValue, inString.nth(1))
|
||||
await link(returnValue, inString.nth(2))
|
||||
await expect(nodes).toHaveCount(4)
|
||||
await expect(links).toHaveCount(3)
|
||||
|
||||
// Remove links and link the each "In String" to "Return Value"
|
||||
|
||||
await nodes.evaluateAll(nodes => nodes
|
||||
.flatMap(n => /** @type {NodeElement} */(n).getPinElements())
|
||||
.forEach(p => p.unlinkFromAll())
|
||||
)
|
||||
await expect(nodes).toHaveCount(4)
|
||||
await expect(links).toHaveCount(0)
|
||||
|
||||
await link(inString.nth(0), returnValue)
|
||||
await link(inString.nth(1), returnValue)
|
||||
await link(inString.nth(2), returnValue)
|
||||
await expect(nodes).toHaveCount(4)
|
||||
await expect(links).toHaveCount(3)
|
||||
})
|
||||
@@ -1,6 +1,6 @@
|
||||
import { expect, test } from "./fixtures/test.js"
|
||||
|
||||
test("Linking 3", async ({ blueprintPage }) => {
|
||||
test("Linking color propagation", async ({ blueprintPage }) => {
|
||||
const source = String.raw`
|
||||
Begin Object Class=/Script/BlueprintGraph.K2Node_Knot Name="K2Node_Knot_25" ExportPath="/Script/BlueprintGraph.K2Node_Knot'/Game/NewWorld.NewWorld:PersistentLevel.NewWorld.EventGraph.K2Node_Knot_25'"
|
||||
NodePosX=976
|
||||
@@ -74,8 +74,6 @@ test("Linking 3", async ({ blueprintPage }) => {
|
||||
const grayColor = "128, 120, 120"
|
||||
const blueColor = "0, 88, 200"
|
||||
|
||||
/** @type {(i: Number) => Locator<NodeElement>} */
|
||||
const getNode = i => blueprintPage.blueprintLocator.locator("ueb-node").nth(i)
|
||||
const link = async (origin, target) => {
|
||||
await origin.hover()
|
||||
await mouse.down()
|
||||
@@ -99,7 +97,6 @@ test("Linking 3", async ({ blueprintPage }) => {
|
||||
await expect(links).toHaveCount(0)
|
||||
|
||||
await blueprintPage.paste(source)
|
||||
await blueprintPage.blueprintLocator.evaluate(b => b.template.centerContentInViewport(false))
|
||||
|
||||
await expect(nodes).toHaveCount(9)
|
||||
await expect(knots).toHaveCount(8)
|
||||
@@ -109,24 +106,20 @@ test("Linking 3", async ({ blueprintPage }) => {
|
||||
for (let i = 0; i < knotsCount; ++i) {
|
||||
expect(await knots.nth(i).evaluate(getKnotColors)).toEqual(Array(4).fill(grayColor))
|
||||
}
|
||||
expect(await links.evaluateAll(links => links.map(l => /** @type {LinkElement} */(l).color.toString())))
|
||||
.toEqual(Array(await links.count()).fill(grayColor))
|
||||
|
||||
const linksCount = await links.count()
|
||||
for (let i = 0; i < linksCount; ++i) {
|
||||
/** @type {Locator<LinkElement>} */
|
||||
const link = links.nth(i)
|
||||
expect(await link.evaluate(l => l.color.toString())).toEqual(grayColor)
|
||||
}
|
||||
|
||||
await link(blueprintPage.blueprintLocator.locator("ueb-pin").getByText("Color", { exact: true }), knots.nth(0))
|
||||
await expect(links).toHaveCount(8)
|
||||
await link(
|
||||
nodes.locator("ueb-pin").filter({ hasText: "Color" }),
|
||||
knots.nth(0),
|
||||
)
|
||||
for (let i = 0; i < knotsCount; ++i) {
|
||||
expect(await knots.nth(i).evaluate(getKnotColors)).toEqual(Array(4).fill(blueColor))
|
||||
}
|
||||
for (let i = 0; i < linksCount; ++i) {
|
||||
/** @type {Locator<LinkElement>} */
|
||||
const link = links.nth(i)
|
||||
expect(await link.evaluate(l => l.color.toString())).toEqual(blueColor)
|
||||
}
|
||||
await expect(links).toHaveCount(8)
|
||||
expect(await links.evaluateAll(links => links.map(l => /** @type {LinkElement} */(l).color.toString())))
|
||||
.toEqual(Array(await links.count()).fill(blueColor))
|
||||
|
||||
await links.evaluateAll(ls => ls.forEach(l => l.remove()))
|
||||
for (let i = 0; i < knotsCount; ++i) {
|
||||
expect(await knots.nth(i).evaluate(getKnotColors)).toEqual(Array(4).fill(grayColor))
|
||||
@@ -1,4 +1,4 @@
|
||||
import { testNode, expect } from "./fixtures/test.js"
|
||||
import { expect, testNode } from "./fixtures/test.js"
|
||||
|
||||
testNode({
|
||||
name: "Conv Transform To String",
|
||||
|
||||
80
tests/nodeDataCount.spec.js
Executable file
80
tests/nodeDataCount.spec.js
Executable file
@@ -0,0 +1,80 @@
|
||||
import Configuration from "../js/Configuration.js"
|
||||
import { expect, testNode } from "./fixtures/test.js"
|
||||
|
||||
testNode({
|
||||
name: "Data Count",
|
||||
title: "Data Num",
|
||||
subtitle: null,
|
||||
value: String.raw`
|
||||
Begin Object Class=/Script/PCGEditor.PCGEditorGraphNode Name="PCGEditorGraphNode_2" ExportPath="/Script/PCGEditor.PCGEditorGraphNode'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2'"
|
||||
Begin Object Class=/Script/PCG.PCGNode Name="DataNum_2" ExportPath="/Script/PCG.PCGNode'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2'"
|
||||
Begin Object Class=/Script/PCG.PCGTrivialSettings Name="DefaultNodeSettings" Archetype="/Script/PCG.PCGTrivialSettings'/Script/PCG.Default__PCGNode:DefaultNodeSettings'" ExportPath="/Script/PCG.PCGTrivialSettings'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2.DefaultNodeSettings'"
|
||||
End Object
|
||||
Begin Object Class=/Script/PCG.PCGDataNumSettings Name="PCGDataNumSettings_0" ExportPath="/Script/PCG.PCGDataNumSettings'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2.PCGDataNumSettings_0'"
|
||||
End Object
|
||||
Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_0" ExportPath="/Script/PCG.PCGPin'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2.PCGPin_0'"
|
||||
End Object
|
||||
Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_1" ExportPath="/Script/PCG.PCGPin'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2.PCGPin_1'"
|
||||
End Object
|
||||
Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_2" ExportPath="/Script/PCG.PCGPin'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2.PCGPin_2'"
|
||||
End Object
|
||||
Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_3" ExportPath="/Script/PCG.PCGPin'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2.PCGPin_3'"
|
||||
End Object
|
||||
End Object
|
||||
Begin Object Name="DataNum_2" ExportPath="/Script/PCG.PCGNode'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2'"
|
||||
Begin Object Name="DefaultNodeSettings" ExportPath="/Script/PCG.PCGTrivialSettings'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2.DefaultNodeSettings'"
|
||||
End Object
|
||||
Begin Object Name="PCGDataNumSettings_0" ExportPath="/Script/PCG.PCGDataNumSettings'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2.PCGDataNumSettings_0'"
|
||||
Seed=45482541
|
||||
CachedOverridableParams(0)=(Label="OutputAttributeName",PropertiesNames=("OutputAttributeName"),PropertyClass="/Script/CoreUObject.Class'/Script/PCG.PCGDataNumSettings'")
|
||||
End Object
|
||||
Begin Object Name="PCGPin_0" ExportPath="/Script/PCG.PCGPin'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2.PCGPin_0'"
|
||||
Node="/Script/PCG.PCGNode'PCGEditorGraphNode_2.DataNum_2'"
|
||||
Properties=(Label="In",PinStatus=Required)
|
||||
End Object
|
||||
Begin Object Name="PCGPin_1" ExportPath="/Script/PCG.PCGPin'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2.PCGPin_1'"
|
||||
Node="/Script/PCG.PCGNode'PCGEditorGraphNode_2.DataNum_2'"
|
||||
Properties=(Label="Overrides",AllowedTypes=Param,PinStatus=OverrideOrUserParam,Tooltip=NSLOCTEXT("PCGSettings", "GlobalParamPinTooltip", "Atribute Set containing multiple parameters to override. Names must match perfectly."))
|
||||
End Object
|
||||
Begin Object Name="PCGPin_2" ExportPath="/Script/PCG.PCGPin'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2.PCGPin_2'"
|
||||
Node="/Script/PCG.PCGNode'PCGEditorGraphNode_2.DataNum_2'"
|
||||
Properties=(Label="OutputAttributeName",AllowedTypes=Param,bAllowMultipleData=False,PinStatus=OverrideOrUserParam,Tooltip=LOCGEN_FORMAT_ORDERED(NSLOCTEXT("PCGSettings", "OverridableParamPinTooltip", "{0}Attribute type is \"{1}\" and its exact name is \"{2}\""), "", NSLOCTEXT("", "F685A80C7F3642D39D0D096256DA7E07", "FName"), NSLOCTEXT("", "0337A20A0B2C400AAE0AF477C663D73D", "OutputAttributeName")),bAllowMultipleConnections=False)
|
||||
End Object
|
||||
Begin Object Name="PCGPin_3" ExportPath="/Script/PCG.PCGPin'/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_0.PCGEditorGraphNode_2.DataNum_2.PCGPin_3'"
|
||||
Node="/Script/PCG.PCGNode'PCGEditorGraphNode_2.DataNum_2'"
|
||||
Properties=(Label="Out",AllowedTypes=Param,Tooltip=NSLOCTEXT("PCGDataNumElement", "OutParamTooltip", "Attribute set containing the data count from the input collection"))
|
||||
End Object
|
||||
PositionX=560
|
||||
PositionY=160
|
||||
SettingsInterface="/Script/PCG.PCGDataNumSettings'PCGDataNumSettings_0'"
|
||||
InputPins(0)="/Script/PCG.PCGPin'PCGPin_0'"
|
||||
InputPins(1)="/Script/PCG.PCGPin'PCGPin_1'"
|
||||
InputPins(2)="/Script/PCG.PCGPin'PCGPin_2'"
|
||||
OutputPins(0)="/Script/PCG.PCGPin'PCGPin_3'"
|
||||
End Object
|
||||
PCGNode="/Script/PCG.PCGNode'DataNum_2'"
|
||||
NodePosX=560
|
||||
NodePosY=160
|
||||
AdvancedPinDisplay=Shown
|
||||
bUserSetEnabledState=True
|
||||
bCanRenameNode=False
|
||||
NodeGuid=7CCECFCAA65840AD93744F46C8689EBB
|
||||
CustomProperties Pin (PinId=E362D4F678C942C08A861CFE7E8FA846,PinName="In",PinFriendlyName="In",PinType.PinCategory="",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=04A829D535AB461AA23D8CA2BB1BF18A,PinName="Overrides",PinFriendlyName="Overrides",PinType.PinCategory="Attribute Set",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=True,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=6843659B0B194D358888D2F44F517B89,PinName="OutputAttributeName",PinFriendlyName=NSLOCTEXT("UObjectDisplayNames", "PCGDataNumSettings:OutputAttributeName", "Output Attribute Name"),PinType.PinCategory="Attribute Set",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=True,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=D863A6ECDFA8449787BE6CA83A3B4617,PinName="Out",PinFriendlyName="Out",Direction="EGPD_Output",PinType.PinCategory="Attribute Set",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,)
|
||||
End Object
|
||||
`,
|
||||
size: [14.5, 9],
|
||||
color: Configuration.nodeColors.blue,
|
||||
icon: null,
|
||||
pins: 4,
|
||||
pinNames: ["In", "Overrides", "Output Attribute Name", "Out"],
|
||||
delegate: false,
|
||||
development: false,
|
||||
additionalTest: async (node, pins) => {
|
||||
for (let i = 0; i < pins.length; ++i) {
|
||||
await expect(pins[i].locator(".ueb-pin-required-mark")).toHaveCount(i == 0 ? 1 : 0)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,6 +1,6 @@
|
||||
import Configuration from "../js/Configuration.js"
|
||||
import SVGIcon from "../js/SVGIcon.js"
|
||||
import { testNode, expect } from "./fixtures/test.js"
|
||||
import { expect, testNode } from "./fixtures/test.js"
|
||||
|
||||
testNode({
|
||||
name: "Print String",
|
||||
|
||||
Reference in New Issue
Block a user