mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-15 01:24:41 +08:00
Some minor fixes and refactoring
This commit is contained in:
99
dist/ueblueprint.js
vendored
99
dist/ueblueprint.js
vendored
@@ -175,6 +175,7 @@ class Configuration {
|
||||
isValid: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:IsValid",
|
||||
kismetArrayLibrary: "/Script/Engine.KismetArrayLibrary",
|
||||
kismetMathLibrary: "/Script/Engine.KismetMathLibrary",
|
||||
kismetStringLibrary: "/Script/Engine.KismetStringLibrary",
|
||||
knot: "/Script/BlueprintGraph.K2Node_Knot",
|
||||
linearColor: "/Script/CoreUObject.LinearColor",
|
||||
literal: "/Script/BlueprintGraph.K2Node_Literal",
|
||||
@@ -3747,10 +3748,6 @@ function nodeColor(entity) {
|
||||
}
|
||||
}
|
||||
switch (entity.getClass()) {
|
||||
case Configuration.paths.callFunction:
|
||||
return entity.bIsPureFunc?.valueOf()
|
||||
? Configuration.nodeColors.green
|
||||
: Configuration.nodeColors.blue
|
||||
case Configuration.paths.niagaraNodeFunctionCall:
|
||||
return Configuration.nodeColors.darkerBlue
|
||||
case Configuration.paths.dynamicCast:
|
||||
@@ -3798,7 +3795,7 @@ function nodeColor(entity) {
|
||||
return Configuration.nodeColors.intenseGreen
|
||||
}
|
||||
}
|
||||
if (entity.bIsPureFunc?.valueOf()) {
|
||||
if (entity.bIsPureFunc?.valueOf() || entity.bDefaultsToPureFunc?.valueOf()) {
|
||||
return Configuration.nodeColors.green
|
||||
}
|
||||
if (entity["Input"]?.["Name"]) {
|
||||
@@ -4376,6 +4373,7 @@ function nodeTitle(entity) {
|
||||
switch (memberParent) {
|
||||
case paths$1.blueprintGameplayTagLibrary:
|
||||
case paths$1.kismetMathLibrary:
|
||||
case paths$1.kismetStringLibrary:
|
||||
case paths$1.slateBlueprintLibrary:
|
||||
case paths$1.timeManagementBlueprintLibrary:
|
||||
const leadingLetter = memberName.match(/[BF]([A-Z]\w+)/);
|
||||
@@ -6335,6 +6333,7 @@ class ObjectEntity extends IEntity {
|
||||
bIsPureFunc: BooleanEntity,
|
||||
bIsConstFunc: BooleanEntity,
|
||||
bIsCaseSensitive: BooleanEntity,
|
||||
bDefaultsToPureFunc: BooleanEntity,
|
||||
VariableReference: VariableReferenceEntity,
|
||||
SelfContextInfo: SymbolEntity,
|
||||
DelegatePropertyName: StringEntity,
|
||||
@@ -6485,6 +6484,7 @@ class ObjectEntity extends IEntity {
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.Archetype>} */ this.Archetype;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.AxisKey>} */ this.AxisKey;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.bIsPureFunc>} */ this.bIsPureFunc;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.bDefaultsToPureFunc>} */ this.bDefaultsToPureFunc;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.BlueprintElementInstance>} */ this.BlueprintElementInstance;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.BlueprintElementType>} */ this.BlueprintElementType;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.Class>} */ this.Class;
|
||||
@@ -8926,17 +8926,13 @@ class NodeTemplate extends ISelectableDraggableTemplate {
|
||||
super.initialize(element);
|
||||
this.#subtitle = nodeSubtitle(element.entity);
|
||||
this.element.classList.add(.../** @type {typeof NodeTemplate} */(this.constructor).nodeStyleClasses);
|
||||
this.element.style.setProperty("--ueb-node-color", this.getColor().cssText);
|
||||
this.element.style.setProperty("--ueb-node-color", this.element.entity.nodeColor().cssText);
|
||||
this.pinInserter = this.element.entity.additionalPinInserter();
|
||||
if (this.pinInserter) {
|
||||
this.element.classList.add("ueb-node-is-variadic");
|
||||
}
|
||||
}
|
||||
|
||||
getColor() {
|
||||
return this.element.entity.nodeColor()
|
||||
}
|
||||
|
||||
render() {
|
||||
return x`
|
||||
<div class="ueb-node-border">
|
||||
@@ -9205,7 +9201,7 @@ class CommentNodeTemplate extends IResizeableTemplate {
|
||||
element.classList.add("ueb-node-style-comment", "ueb-node-resizeable");
|
||||
element.sizeX = 25 * Configuration.gridSize;
|
||||
element.sizeY = 6 * Configuration.gridSize;
|
||||
super.initialize(element); // Keep it at the end because it calls this.getColor() where this.#color must be initialized
|
||||
super.initialize(element); // Keep it at the end because it needs the color. this.#color must be initialized
|
||||
}
|
||||
|
||||
/** @returns {HTMLElement} */
|
||||
@@ -9303,9 +9299,6 @@ class MouseCreateLink extends IMouseClickDrag {
|
||||
/** @type {NodeListOf<PinElement>} */
|
||||
#listenedPins
|
||||
|
||||
/** @type {PinElement} */
|
||||
#knotPin = null
|
||||
|
||||
/** @param {MouseEvent} e */
|
||||
#mouseenterHandler = e => {
|
||||
if (!this.enteredPin) {
|
||||
@@ -9369,9 +9362,6 @@ class MouseCreateLink extends IMouseClickDrag {
|
||||
}
|
||||
|
||||
startDrag(location) {
|
||||
if (this.target.isKnot()) {
|
||||
this.#knotPin = this.target;
|
||||
}
|
||||
/** @type {LinkElement} */
|
||||
this.link = /** @type {LinkElementConstructor} */(ElementFactory.getConstructor("ueb-link"))
|
||||
.newObject(this.target, null);
|
||||
@@ -9399,20 +9389,22 @@ class MouseCreateLink extends IMouseClickDrag {
|
||||
});
|
||||
this.#listenedPins = null;
|
||||
if (this.enteredPin && this.linkValid) {
|
||||
const knot = this.enteredPin.isKnot()
|
||||
? this.enteredPin
|
||||
: this.link.origin.isKnot() ? this.link.origin : null;
|
||||
// Knot can use wither the input or output (by default) part indifferently, check if a switch is needed
|
||||
if (this.#knotPin) {
|
||||
const otherPin = this.#knotPin !== this.link.origin ? this.link.origin : this.enteredPin;
|
||||
if (knot) {
|
||||
const otherPin = knot !== 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).getoppositePin();
|
||||
if (this.#knotPin === this.link.origin) {
|
||||
if (knot.isInput() && otherPin.isInput() || knot.isOutput() && otherPin.isOutput()) {
|
||||
const oppositePin = /** @type {KnotPinTemplate} */(knot.template).getoppositePin();
|
||||
if (knot === this.link.origin) {
|
||||
this.link.origin = oppositePin;
|
||||
} else {
|
||||
this.enteredPin = oppositePin;
|
||||
}
|
||||
}
|
||||
} else if (this.enteredPin.isKnot()) {
|
||||
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).getoppositePin();
|
||||
@@ -9431,7 +9423,6 @@ class MouseCreateLink extends IMouseClickDrag {
|
||||
this.link.removeMessage();
|
||||
this.link.finishDragging();
|
||||
this.link = null;
|
||||
this.#knotPin = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9828,6 +9819,17 @@ class KnotNodeTemplate extends NodeTemplate {
|
||||
this.element.classList.add("ueb-node-style-minimal");
|
||||
}
|
||||
|
||||
/** @param {PropertyValues} changedProperties */
|
||||
update(changedProperties) {
|
||||
super.update(changedProperties);
|
||||
if (!this.#inputPin.isLinked && !this.#outputPin.isLinked) {
|
||||
this.#inputPin.entity.PinType.PinCategory.value = "wildcard";
|
||||
this.#inputPin.updateColor();
|
||||
this.#outputPin.entity.PinType.PinCategory.value = "wildcard";
|
||||
this.#inputPin.updateColor();
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return x`
|
||||
<div class="ueb-node-border"></div>
|
||||
@@ -9903,7 +9905,7 @@ class VariableAccessNodeTemplate extends VariableManagementNodeTemplate {
|
||||
setupPins() {
|
||||
super.setupPins();
|
||||
let outputPin = this.element.getPinElements().find(p => !p.entity.isHidden() && !p.entity.isExecution());
|
||||
this.element.style.setProperty("--ueb-node-color", outputPin.getColor().cssText);
|
||||
this.element.style.setProperty("--ueb-node-color", outputPin.entity.pinColor().cssText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9976,10 +9978,11 @@ const paths = Configuration.paths;
|
||||
* @return {new () => NodeTemplate}
|
||||
*/
|
||||
function nodeTemplateClass(nodeEntity) {
|
||||
const className = nodeEntity.getClass();
|
||||
if (
|
||||
nodeEntity.getClass() === paths.callFunction
|
||||
|| nodeEntity.getClass() === paths.commutativeAssociativeBinaryOperator
|
||||
|| nodeEntity.getClass() === paths.callArrayFunction
|
||||
className === paths.callFunction
|
||||
|| className === paths.commutativeAssociativeBinaryOperator
|
||||
|| className === paths.callArrayFunction
|
||||
) {
|
||||
const memberParent = nodeEntity.FunctionReference?.MemberParent?.path ?? "";
|
||||
const memberName = nodeEntity.FunctionReference?.MemberName?.toString();
|
||||
@@ -9987,6 +9990,7 @@ function nodeTemplateClass(nodeEntity) {
|
||||
memberName && (
|
||||
memberParent === paths.kismetMathLibrary
|
||||
|| memberParent === paths.kismetArrayLibrary
|
||||
|| memberParent === paths.kismetStringLibrary
|
||||
)) {
|
||||
if (memberName.startsWith("Conv_")) {
|
||||
return VariableConversionNodeTemplate
|
||||
@@ -10046,7 +10050,7 @@ function nodeTemplateClass(nodeEntity) {
|
||||
return VariableOperationNodeTemplate
|
||||
}
|
||||
}
|
||||
switch (nodeEntity.getClass()) {
|
||||
switch (className) {
|
||||
case paths.comment:
|
||||
case paths.materialGraphNodeComment:
|
||||
return CommentNodeTemplate
|
||||
@@ -12089,7 +12093,9 @@ class InputTemplate extends ITemplate {
|
||||
super.initialize(element);
|
||||
this.element.classList.add("ueb-pin-input-content");
|
||||
this.element.setAttribute("role", "textbox");
|
||||
this.element.contentEditable = "true";
|
||||
if (this.element.contentEditable !== "false") {
|
||||
this.element.contentEditable = "true";
|
||||
}
|
||||
}
|
||||
|
||||
/** @param {PropertyValues} changedProperties */
|
||||
@@ -12158,6 +12164,7 @@ class InputElement extends IElement {
|
||||
this.singleLine = false;
|
||||
this.selectOnFocus = true;
|
||||
this.blurOnEnter = true;
|
||||
this.editable = true;
|
||||
super.initialize({}, new InputTemplate());
|
||||
}
|
||||
|
||||
@@ -13004,6 +13011,23 @@ class NamePinTemplate extends IInputPinTemplate {
|
||||
static singleLineInput = true
|
||||
}
|
||||
|
||||
/** @extends PinTemplate<StringEntity> */
|
||||
class ReadonlyNamePinTemplate extends PinTemplate {
|
||||
|
||||
setDefaultValue(values = [], rawValues = values) {
|
||||
}
|
||||
|
||||
renderInput() {
|
||||
return x`
|
||||
<div class="ueb-pin-input-wrapper ueb-pin-input">
|
||||
<ueb-input contenteditable="false" .singleLine="${true}" .selectOnFocus="${false}"
|
||||
.innerText="${this.element.entity.PinName.toString()}">
|
||||
</ueb-input>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @template {NumberEntity} T
|
||||
* @extends INumericPinTemplate<T>
|
||||
@@ -13274,6 +13298,9 @@ function pinTemplate(entity) {
|
||||
if (entity.isExecution()) {
|
||||
return ExecPinTemplate
|
||||
}
|
||||
if (entity.PinName?.toString() === "self" && pinTitle(entity) === "Target") {
|
||||
return ReadonlyNamePinTemplate
|
||||
}
|
||||
const type = entity.getType();
|
||||
return (entity.isInput() ? inputPinTemplates[type] : PinTemplate) ?? PinTemplate
|
||||
}
|
||||
@@ -13366,8 +13393,8 @@ class PinElement extends IElement {
|
||||
this.pinId = this.entity.PinId;
|
||||
this.pinType = this.entity.getType();
|
||||
this.defaultValue = this.entity.getDefaultValue();
|
||||
this.color = PinElement.properties.color.converter.fromAttribute(this.getColor().toString());
|
||||
this.pinDirection = entity.isInput() ? "input" : entity.isOutput() ? "output" : "hidden";
|
||||
this.updateColor();
|
||||
}
|
||||
|
||||
setup() {
|
||||
@@ -13375,6 +13402,10 @@ class PinElement extends IElement {
|
||||
this.nodeElement = this.closest("ueb-node");
|
||||
}
|
||||
|
||||
updateColor() {
|
||||
this.color = PinElement.properties.color.converter.fromAttribute(this.entity.pinColor().toString());
|
||||
}
|
||||
|
||||
createPinReference() {
|
||||
return new PinReferenceEntity(new SymbolEntity(this.nodeElement.getNodeName()), this.getPinId())
|
||||
}
|
||||
@@ -13391,11 +13422,6 @@ class PinElement extends IElement {
|
||||
return this.entity.pinTitle()
|
||||
}
|
||||
|
||||
/** @return {CSSResult} */
|
||||
getColor() {
|
||||
return this.entity.pinColor()
|
||||
}
|
||||
|
||||
/** @param {PinElement} pin */
|
||||
#traverseKnots(pin) {
|
||||
while (pin?.isKnot()) {
|
||||
@@ -13537,7 +13563,6 @@ class PinElement extends IElement {
|
||||
}
|
||||
|
||||
unlinkFromAll() {
|
||||
this.getLinks().length;
|
||||
this.getLinks().map(ref => this.blueprint.getPin(ref)).forEach(pin => this.unlinkFrom(pin));
|
||||
}
|
||||
|
||||
|
||||
6
dist/ueblueprint.min.js
vendored
6
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -151,6 +151,7 @@ export default class Configuration {
|
||||
isValid: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:IsValid",
|
||||
kismetArrayLibrary: "/Script/Engine.KismetArrayLibrary",
|
||||
kismetMathLibrary: "/Script/Engine.KismetMathLibrary",
|
||||
kismetStringLibrary: "/Script/Engine.KismetStringLibrary",
|
||||
knot: "/Script/BlueprintGraph.K2Node_Knot",
|
||||
linearColor: "/Script/CoreUObject.LinearColor",
|
||||
literal: "/Script/BlueprintGraph.K2Node_Literal",
|
||||
|
||||
@@ -31,10 +31,6 @@ export default function nodeColor(entity) {
|
||||
}
|
||||
}
|
||||
switch (entity.getClass()) {
|
||||
case Configuration.paths.callFunction:
|
||||
return entity.bIsPureFunc?.valueOf()
|
||||
? Configuration.nodeColors.green
|
||||
: Configuration.nodeColors.blue
|
||||
case Configuration.paths.niagaraNodeFunctionCall:
|
||||
return Configuration.nodeColors.darkerBlue
|
||||
case Configuration.paths.dynamicCast:
|
||||
@@ -82,7 +78,7 @@ export default function nodeColor(entity) {
|
||||
return Configuration.nodeColors.intenseGreen
|
||||
}
|
||||
}
|
||||
if (entity.bIsPureFunc?.valueOf()) {
|
||||
if (entity.bIsPureFunc?.valueOf() || entity.bDefaultsToPureFunc?.valueOf()) {
|
||||
return Configuration.nodeColors.green
|
||||
}
|
||||
if (entity["Input"]?.["Name"]) {
|
||||
|
||||
@@ -78,10 +78,11 @@ const paths = Configuration.paths
|
||||
* @return {new () => NodeTemplate}
|
||||
*/
|
||||
export default function nodeTemplateClass(nodeEntity) {
|
||||
const className = nodeEntity.getClass()
|
||||
if (
|
||||
nodeEntity.getClass() === paths.callFunction
|
||||
|| nodeEntity.getClass() === paths.commutativeAssociativeBinaryOperator
|
||||
|| nodeEntity.getClass() === paths.callArrayFunction
|
||||
className === paths.callFunction
|
||||
|| className === paths.commutativeAssociativeBinaryOperator
|
||||
|| className === paths.callArrayFunction
|
||||
) {
|
||||
const memberParent = nodeEntity.FunctionReference?.MemberParent?.path ?? ""
|
||||
const memberName = nodeEntity.FunctionReference?.MemberName?.toString()
|
||||
@@ -89,6 +90,7 @@ export default function nodeTemplateClass(nodeEntity) {
|
||||
memberName && (
|
||||
memberParent === paths.kismetMathLibrary
|
||||
|| memberParent === paths.kismetArrayLibrary
|
||||
|| memberParent === paths.kismetStringLibrary
|
||||
)) {
|
||||
if (memberName.startsWith("Conv_")) {
|
||||
return VariableConversionNodeTemplate
|
||||
@@ -148,7 +150,7 @@ export default function nodeTemplateClass(nodeEntity) {
|
||||
return VariableOperationNodeTemplate
|
||||
}
|
||||
}
|
||||
switch (nodeEntity.getClass()) {
|
||||
switch (className) {
|
||||
case paths.comment:
|
||||
case paths.materialGraphNodeComment:
|
||||
return CommentNodeTemplate
|
||||
|
||||
@@ -372,6 +372,7 @@ export default function nodeTitle(entity) {
|
||||
switch (memberParent) {
|
||||
case paths.blueprintGameplayTagLibrary:
|
||||
case paths.kismetMathLibrary:
|
||||
case paths.kismetStringLibrary:
|
||||
case paths.slateBlueprintLibrary:
|
||||
case paths.timeManagementBlueprintLibrary:
|
||||
const leadingLetter = memberName.match(/[BF]([A-Z]\w+)/)
|
||||
|
||||
@@ -7,6 +7,7 @@ import IntPinTemplate from "../template/pin/IntPinTemplate.js"
|
||||
import LinearColorPinTemplate from "../template/pin/LinearColorPinTemplate.js"
|
||||
import NamePinTemplate from "../template/pin/NamePinTemplate.js"
|
||||
import PinTemplate from "../template/pin/PinTemplate.js"
|
||||
import ReadonlyNamePinTemplate from "../template/pin/ReadonlyInputPinTemplate.js"
|
||||
import RealPinTemplate from "../template/pin/RealPinTemplate.js"
|
||||
import ReferencePinTemplate from "../template/pin/ReferencePinTemplate.js"
|
||||
import RotatorPinTemplate from "../template/pin/RotatorPinTemplate.js"
|
||||
@@ -14,6 +15,7 @@ import StringPinTemplate from "../template/pin/StringPinTemplate.js"
|
||||
import Vector2DPinTemplate from "../template/pin/Vector2DPinTemplate.js"
|
||||
import Vector4DPinTemplate from "../template/pin/Vector4DPinTemplate.js"
|
||||
import VectorPinTemplate from "../template/pin/VectorPinTemplate.js"
|
||||
import pinTitle from "./pinTitle.js"
|
||||
|
||||
const inputPinTemplates = {
|
||||
"bool": BoolPinTemplate,
|
||||
@@ -51,6 +53,9 @@ export default function pinTemplate(entity) {
|
||||
if (entity.isExecution()) {
|
||||
return ExecPinTemplate
|
||||
}
|
||||
if (entity.PinName?.toString() === "self" && pinTitle(entity) === "Target") {
|
||||
return ReadonlyNamePinTemplate
|
||||
}
|
||||
const type = entity.getType()
|
||||
return (entity.isInput() ? inputPinTemplates[type] : PinTemplate) ?? PinTemplate
|
||||
}
|
||||
|
||||
@@ -98,8 +98,8 @@ export default class PinElement extends IElement {
|
||||
this.pinId = this.entity.PinId
|
||||
this.pinType = this.entity.getType()
|
||||
this.defaultValue = this.entity.getDefaultValue()
|
||||
this.color = PinElement.properties.color.converter.fromAttribute(this.getColor().toString())
|
||||
this.pinDirection = entity.isInput() ? "input" : entity.isOutput() ? "output" : "hidden"
|
||||
this.updateColor()
|
||||
}
|
||||
|
||||
setup() {
|
||||
@@ -107,6 +107,10 @@ export default class PinElement extends IElement {
|
||||
this.nodeElement = this.closest("ueb-node")
|
||||
}
|
||||
|
||||
updateColor() {
|
||||
this.color = PinElement.properties.color.converter.fromAttribute(this.entity.pinColor().toString())
|
||||
}
|
||||
|
||||
createPinReference() {
|
||||
return new PinReferenceEntity(new SymbolEntity(this.nodeElement.getNodeName()), this.getPinId())
|
||||
}
|
||||
@@ -123,11 +127,6 @@ export default class PinElement extends IElement {
|
||||
return this.entity.pinTitle()
|
||||
}
|
||||
|
||||
/** @return {CSSResult} */
|
||||
getColor() {
|
||||
return this.entity.pinColor()
|
||||
}
|
||||
|
||||
/** @param {PinElement} pin */
|
||||
#traverseKnots(pin) {
|
||||
while (pin?.isKnot()) {
|
||||
@@ -271,8 +270,8 @@ export default class PinElement extends IElement {
|
||||
}
|
||||
|
||||
unlinkFromAll() {
|
||||
const isLinked = this.getLinks().length
|
||||
this.getLinks().map(ref => this.blueprint.getPin(ref)).forEach(pin => this.unlinkFrom(pin))
|
||||
const isLinked = false
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -63,6 +63,7 @@ export default class ObjectEntity extends IEntity {
|
||||
bIsPureFunc: BooleanEntity,
|
||||
bIsConstFunc: BooleanEntity,
|
||||
bIsCaseSensitive: BooleanEntity,
|
||||
bDefaultsToPureFunc: BooleanEntity,
|
||||
VariableReference: VariableReferenceEntity,
|
||||
SelfContextInfo: SymbolEntity,
|
||||
DelegatePropertyName: StringEntity,
|
||||
@@ -213,6 +214,7 @@ export default class ObjectEntity extends IEntity {
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.Archetype>} */ this.Archetype
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.AxisKey>} */ this.AxisKey
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.bIsPureFunc>} */ this.bIsPureFunc
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.bDefaultsToPureFunc>} */ this.bDefaultsToPureFunc
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.BlueprintElementInstance>} */ this.BlueprintElementInstance
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.BlueprintElementType>} */ this.BlueprintElementType
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.Class>} */ this.Class
|
||||
|
||||
@@ -14,9 +14,6 @@ export default class MouseCreateLink extends IMouseClickDrag {
|
||||
/** @type {NodeListOf<PinElement>} */
|
||||
#listenedPins
|
||||
|
||||
/** @type {PinElement} */
|
||||
#knotPin = null
|
||||
|
||||
/** @param {MouseEvent} e */
|
||||
#mouseenterHandler = e => {
|
||||
if (!this.enteredPin) {
|
||||
@@ -80,9 +77,6 @@ export default class MouseCreateLink extends IMouseClickDrag {
|
||||
}
|
||||
|
||||
startDrag(location) {
|
||||
if (this.target.isKnot()) {
|
||||
this.#knotPin = this.target
|
||||
}
|
||||
/** @type {LinkElement} */
|
||||
this.link = /** @type {LinkElementConstructor} */(ElementFactory.getConstructor("ueb-link"))
|
||||
.newObject(this.target, null)
|
||||
@@ -110,20 +104,22 @@ export default class MouseCreateLink extends IMouseClickDrag {
|
||||
})
|
||||
this.#listenedPins = null
|
||||
if (this.enteredPin && this.linkValid) {
|
||||
const knot = this.enteredPin.isKnot()
|
||||
? this.enteredPin
|
||||
: this.link.origin.isKnot() ? this.link.origin : null
|
||||
// Knot can use wither the input or output (by default) part indifferently, check if a switch is needed
|
||||
if (this.#knotPin) {
|
||||
const otherPin = this.#knotPin !== this.link.origin ? this.link.origin : this.enteredPin
|
||||
if (knot) {
|
||||
const otherPin = knot !== 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).getoppositePin()
|
||||
if (this.#knotPin === this.link.origin) {
|
||||
if (knot.isInput() && otherPin.isInput() || knot.isOutput() && otherPin.isOutput()) {
|
||||
const oppositePin = /** @type {KnotPinTemplate} */(knot.template).getoppositePin()
|
||||
if (knot === this.link.origin) {
|
||||
this.link.origin = oppositePin
|
||||
} else {
|
||||
this.enteredPin = oppositePin
|
||||
}
|
||||
}
|
||||
} else if (this.enteredPin.isKnot()) {
|
||||
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).getoppositePin()
|
||||
@@ -142,6 +138,5 @@ export default class MouseCreateLink extends IMouseClickDrag {
|
||||
this.link.removeMessage()
|
||||
this.link.finishDragging()
|
||||
this.link = null
|
||||
this.#knotPin = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export default class CommentNodeTemplate extends IResizeableTemplate {
|
||||
element.classList.add("ueb-node-style-comment", "ueb-node-resizeable")
|
||||
element.sizeX = 25 * Configuration.gridSize
|
||||
element.sizeY = 6 * Configuration.gridSize
|
||||
super.initialize(element) // Keep it at the end because it calls this.getColor() where this.#color must be initialized
|
||||
super.initialize(element) // Keep it at the end because it needs the color. this.#color must be initialized
|
||||
}
|
||||
|
||||
/** @returns {HTMLElement} */
|
||||
|
||||
@@ -35,6 +35,17 @@ export default class KnotNodeTemplate extends NodeTemplate {
|
||||
this.element.classList.add("ueb-node-style-minimal")
|
||||
}
|
||||
|
||||
/** @param {PropertyValues} changedProperties */
|
||||
update(changedProperties) {
|
||||
super.update(changedProperties)
|
||||
if (!this.#inputPin.isLinked && !this.#outputPin.isLinked) {
|
||||
this.#inputPin.entity.PinType.PinCategory.value = "wildcard"
|
||||
this.#inputPin.updateColor()
|
||||
this.#outputPin.entity.PinType.PinCategory.value = "wildcard"
|
||||
this.#inputPin.updateColor()
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<div class="ueb-node-border"></div>
|
||||
|
||||
@@ -57,17 +57,13 @@ export default class NodeTemplate extends ISelectableDraggableTemplate {
|
||||
super.initialize(element)
|
||||
this.#subtitle = nodeSubtitle(element.entity)
|
||||
this.element.classList.add(.../** @type {typeof NodeTemplate} */(this.constructor).nodeStyleClasses)
|
||||
this.element.style.setProperty("--ueb-node-color", this.getColor().cssText)
|
||||
this.element.style.setProperty("--ueb-node-color", this.element.entity.nodeColor().cssText)
|
||||
this.pinInserter = this.element.entity.additionalPinInserter()
|
||||
if (this.pinInserter) {
|
||||
this.element.classList.add("ueb-node-is-variadic")
|
||||
}
|
||||
}
|
||||
|
||||
getColor() {
|
||||
return this.element.entity.nodeColor()
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<div class="ueb-node-border">
|
||||
|
||||
@@ -21,6 +21,6 @@ export default class VariableAccessNodeTemplate extends VariableManagementNodeTe
|
||||
setupPins() {
|
||||
super.setupPins()
|
||||
let outputPin = this.element.getPinElements().find(p => !p.entity.isHidden() && !p.entity.isExecution())
|
||||
this.element.style.setProperty("--ueb-node-color", outputPin.getColor().cssText)
|
||||
this.element.style.setProperty("--ueb-node-color", outputPin.entity.pinColor().cssText)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,9 @@ export default class InputTemplate extends ITemplate {
|
||||
super.initialize(element)
|
||||
this.element.classList.add("ueb-pin-input-content")
|
||||
this.element.setAttribute("role", "textbox")
|
||||
this.element.contentEditable = "true"
|
||||
if (this.element.contentEditable !== "false") {
|
||||
this.element.contentEditable = "true"
|
||||
}
|
||||
}
|
||||
|
||||
/** @param {PropertyValues} changedProperties */
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import MinimalPinTemplate from "./MinimalPinTemplate.js"
|
||||
|
||||
export default class InternalPinTemplate extends MinimalPinTemplate {
|
||||
|
||||
}
|
||||
19
js/template/pin/ReadonlyInputPinTemplate.js
Executable file
19
js/template/pin/ReadonlyInputPinTemplate.js
Executable file
@@ -0,0 +1,19 @@
|
||||
import { html } from "lit"
|
||||
import PinTemplate from "./PinTemplate.js"
|
||||
|
||||
/** @extends PinTemplate<StringEntity> */
|
||||
export default class ReadonlyNamePinTemplate extends PinTemplate {
|
||||
|
||||
setDefaultValue(values = [], rawValues = values) {
|
||||
}
|
||||
|
||||
renderInput() {
|
||||
return html`
|
||||
<div class="ueb-pin-input-wrapper ueb-pin-input">
|
||||
<ueb-input contenteditable="false" .singleLine="${true}" .selectOnFocus="${false}"
|
||||
.innerText="${this.element.entity.PinName.toString()}">
|
||||
</ueb-input>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import { defineConfig, devices } from "@playwright/test"
|
||||
/**
|
||||
* @see https://playwright.dev/docs/test-configuration
|
||||
*/
|
||||
defineConfig({
|
||||
export default defineConfig({
|
||||
testDir: './tests',
|
||||
/* Run tests in files in parallel */
|
||||
fullyParallel: true,
|
||||
|
||||
7
tests/fixtures/BlueprintFixture.js
vendored
7
tests/fixtures/BlueprintFixture.js
vendored
@@ -32,6 +32,12 @@ export default class BlueprintFixture {
|
||||
}
|
||||
}
|
||||
|
||||
async clone() {
|
||||
const result = new BlueprintFixture(await this.page.context().newPage())
|
||||
await result.setup()
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Locator<HTMLElement>} draggable
|
||||
* @param {Coordinates} offset
|
||||
@@ -144,6 +150,7 @@ export default class BlueprintFixture {
|
||||
}
|
||||
|
||||
async cleanup() {
|
||||
await this.page.close()
|
||||
}
|
||||
|
||||
blur() {
|
||||
|
||||
@@ -63,12 +63,12 @@ test("Issue 30", async ({ blueprintPage }) => {
|
||||
`)
|
||||
await expect(blueprintPage.blueprintLocator.locator("ueb-node")).toHaveCount(5)
|
||||
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(4)
|
||||
expect(blueprintPage.blueprintLocator.evaluate(blueprint =>
|
||||
expect(await blueprintPage.blueprintLocator.evaluate(blueprint =>
|
||||
/** @type {KnotNodeTemplate} */(
|
||||
/** @type {NodeElement} */(blueprint.querySelectorAll("ueb-node")[3]).template
|
||||
).switchDirectionsVisually
|
||||
)).toBeTruthy()
|
||||
expect(blueprintPage.blueprintLocator.evaluate(blueprint =>
|
||||
expect(await blueprintPage.blueprintLocator.evaluate(blueprint =>
|
||||
/** @type {KnotNodeTemplate} */(
|
||||
/** @type {NodeElement} */(blueprint.querySelectorAll("ueb-node")[4]).template
|
||||
).switchDirectionsVisually
|
||||
|
||||
83
tests/linking2.spec.js
Executable file
83
tests/linking2.spec.js
Executable file
@@ -0,0 +1,83 @@
|
||||
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()
|
||||
|
||||
})
|
||||
@@ -3,6 +3,7 @@ import { expect, test } from "./fixtures/test.js"
|
||||
const firstRowOnly = v => v.replaceAll(/^\s+|\n.+/gs, "")
|
||||
|
||||
test("Inner renaming", async ({ blueprintPage }) => {
|
||||
blueprintPage = await blueprintPage.clone()
|
||||
let source = String.raw`
|
||||
Begin Object Class=/Script/PCGEditor.PCGEditorGraphNode Name="PCGEditorGraphNode_2" ExportPath=/Script/PCGEditor.PCGEditorGraphNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2"'
|
||||
Begin Object Class=/Script/PCG.PCGNode Name="ExecuteBlueprint_7" ExportPath=/Script/PCG.PCGNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7"'
|
||||
@@ -169,4 +170,5 @@ test("Inner renaming", async ({ blueprintPage }) => {
|
||||
))).toEqual(
|
||||
`Begin Object Name="PCGBlueprintSettings_0" ExportPath=/Script/PCG.PCGBlueprintSettings'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1..ExecuteBlueprint_7.PCGBlueprintSettings_0"'`
|
||||
)
|
||||
blueprintPage.cleanup()
|
||||
})
|
||||
|
||||
@@ -3,6 +3,7 @@ import { expect, test } from "./fixtures/test.js"
|
||||
const firstRowOnly = v => v.replaceAll(/^\s+|\n.+/gs, "")
|
||||
|
||||
test("Renaming", async ({ blueprintPage }) => {
|
||||
blueprintPage = await blueprintPage.clone()
|
||||
let source = String.raw`
|
||||
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_40" ExportPath=/Script/UnrealEd.MaterialGraphNode'"/Engine/Transient.M_Brick_Cut_Stone:MaterialGraph_0.MaterialGraphNode_40"'
|
||||
End Object
|
||||
@@ -27,4 +28,5 @@ test("Renaming", async ({ blueprintPage }) => {
|
||||
expect(firstRowOnly(await blueprintPage.getSerializedNodes())).toEqual(
|
||||
`Begin Object Class=/Script/UnrealEd.MaterialGraphNode ExportPath=/Script/UnrealEd.MaterialGraphNode'"/Engine/Transient.M_Brick_Cut_Stone:MaterialGraph_0."'`
|
||||
)
|
||||
await blueprintPage.cleanup()
|
||||
})
|
||||
|
||||
@@ -36,9 +36,8 @@ test.describe("Niagara ScriptVariables", () => {
|
||||
await blueprintPage.removeNodes()
|
||||
})
|
||||
|
||||
test.describe.configure({ mode: "parallel" })
|
||||
|
||||
test("Deserialization", async ({ blueprintPage }) => {
|
||||
blueprintPage = await blueprintPage.clone()
|
||||
expect(await blueprintPage.blueprintLocator.evaluate(blueprint => blueprint.entity.serialize()))
|
||||
.toEqual('Begin Object Name="Blueprint"\nEnd Object\n')
|
||||
const source = String.raw`
|
||||
@@ -83,9 +82,11 @@ test.describe("Niagara ScriptVariables", () => {
|
||||
return entity.serialize()
|
||||
}))
|
||||
.toEqual(serialized(source, "###########"))
|
||||
blueprintPage.cleanup()
|
||||
})
|
||||
|
||||
test("Merging", async ({ blueprintPage }) => {
|
||||
blueprintPage = await blueprintPage.clone()
|
||||
// Var: Local.Module.Input, Local.Module.Input001, Local.Module.NewOutput
|
||||
let source = String.raw`
|
||||
Begin Object Class=/Script/NiagaraEditor.NiagaraClipboardContent Name="NiagaraClipboardContent_6" ExportPath="/Script/NiagaraEditor.NiagaraClipboardContent'/Engine/Transient.NiagaraClipboardContent_6'"
|
||||
@@ -357,5 +358,6 @@ test.describe("Niagara ScriptVariables", () => {
|
||||
.filter(v => v?.length > 0)
|
||||
source = await blueprintPage.getSerializedNodes()
|
||||
expect(source).toMatch(Utility.getFirstWordOrder(expectedWords))
|
||||
blueprintPage.cleanup()
|
||||
})
|
||||
})
|
||||
|
||||
32
tests/nodeConv_TransformToString.spec.js
Executable file
32
tests/nodeConv_TransformToString.spec.js
Executable file
@@ -0,0 +1,32 @@
|
||||
import { testNode, expect } from "./fixtures/test.js"
|
||||
|
||||
testNode({
|
||||
name: "Conv Transform To String",
|
||||
title: "",
|
||||
value: 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="Conv_TransformToString")
|
||||
NodePosX=2640
|
||||
NodePosY=-1152
|
||||
NodeGuid=5DE5CD9FB3DD44ADA7C373D59EA63D23
|
||||
CustomProperties Pin (PinId=A1DEA5655C524429A83F3447B2DB6A42,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=50F38A250A1944A4A2AFF41A4AE5092C,PinName="InTrans",PinToolTip="In Trans\nTrasformazione (by ref)",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/CoreUObject.Transform'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=True,PinType.bIsConst=True,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=0A7DB6976935430EAF08AEA50D0C6278,PinName="ReturnValue",PinToolTip="Return Value\nStringa\n\nConverte un valore di trasformazione in una stringa, nel formato \'Translazione: X= Y= Z= Rotazione: P= Y= R= Scala: X= Y= Z=\'",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,LinkedTo=(K2Node_CallFunction_0 06ED5D76ADEE42119EC0A4761E2689CE,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
End Object
|
||||
`,
|
||||
pins: 2,
|
||||
delegate: false,
|
||||
development: false,
|
||||
additionalTest: async node => {
|
||||
expect(await node.evaluate(node => node.classList.contains("ueb-node-style-glass"))).toBeTruthy()
|
||||
expect(await node.evaluate(node => node.classList.contains("ueb-node-style-conversion"))).toBeTruthy()
|
||||
expect(await node.evaluate(node => node.classList.contains("ueb-node-style-default"))).toBeFalsy()
|
||||
expect(await node.locator("ueb-pin").nth(0).evaluate(pin =>
|
||||
/** @type {PinElement} */(pin).entity.pinColor().toString()
|
||||
)).toEqual("227, 103, 0")
|
||||
expect(await node.locator("ueb-pin").nth(1).evaluate(pin =>
|
||||
/** @type {PinElement} */(pin).entity.pinColor().toString()
|
||||
)).toEqual("251, 0, 208")
|
||||
},
|
||||
})
|
||||
26
tests/nodeGetTransform.spec.js
Executable file
26
tests/nodeGetTransform.spec.js
Executable file
@@ -0,0 +1,26 @@
|
||||
import Configuration from "../js/Configuration.js"
|
||||
import SVGIcon from "../js/SVGIcon.js"
|
||||
import { testNode } from "./fixtures/test.js"
|
||||
|
||||
testNode({
|
||||
name: "Get Transform",
|
||||
subtitle: "Target is Actor",
|
||||
value: String.raw`
|
||||
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'"
|
||||
bDefaultsToPureFunc=True
|
||||
FunctionReference=(MemberName="GetTransform",bSelfContext=True)
|
||||
NodePosX=2416
|
||||
NodePosY=-720
|
||||
NodeGuid=CFB627D77A3A4419AFF2A5539B872404
|
||||
CustomProperties Pin (PinId=2BC8CE91A0424570A4CCEBCC33E102C4,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nActor Riferimento Oggetto",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/Engine.Actor'",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=BDF15274D22541DA9E33F342F6341F11,PinName="ReturnValue",PinToolTip="Return Value\nTrasformazione (by ref)\n\nLa trasformazione che trasforma lo spazio dell\'attore in quello del mondo.",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/CoreUObject.Transform'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=True,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_Knot_8 47E4D9AF4CD414564F484A96E876E80B,K2Node_Knot_5 47E4D9AF4CD414564F484A96E876E80B,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=True,bAdvancedView=False,bOrphanedPin=False,)
|
||||
End Object
|
||||
`,
|
||||
size: [15, 5],
|
||||
color: Configuration.nodeColors.green,
|
||||
icon: SVGIcon.functionSymbol,
|
||||
pins: 2,
|
||||
pinNames: ["Target", "Return Value"],
|
||||
delegate: false,
|
||||
development: false,
|
||||
})
|
||||
Reference in New Issue
Block a user