mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
Make struct node
This commit is contained in:
@@ -498,6 +498,30 @@ const tests = [
|
||||
delegate: false,
|
||||
development: false,
|
||||
},
|
||||
{
|
||||
name: "Make Some_§-AStruct",
|
||||
value: String.raw`
|
||||
Begin Object Class=/Script/BlueprintGraph.K2Node_MakeStruct Name="K2Node_MakeStruct_1" ExportPath=/Script/BlueprintGraph.K2Node_MakeStruct'"/Temp/Untitled_1.Untitled_1:PersistentLevel.Untitled.EventGraph.K2Node_MakeStruct_1"'
|
||||
"bMadeAfterOverridePinRemoval"=True
|
||||
"ShowPinForProperties"(0)=(PropertyName="FirstVariable_1_13DD7A0E491E619509C7408F7D8C4071",PropertyFriendlyName="First.Variable",bShowPin=True,bCanToggleVisibility=True)
|
||||
"ShowPinForProperties"(1)=(PropertyName="Second-Variable_5_B897B051478F270D20FF29B3BC3B5A8C",PropertyFriendlyName="Second-Variable",bShowPin=True,bCanToggleVisibility=True)
|
||||
"StructType"=/Script/Engine.UserDefinedStruct'"/Game/StarterContent/Blueprints/Some_§-AStruct.Some_§-AStruct"'
|
||||
"NodePosX"=384
|
||||
"NodePosY"=144
|
||||
"NodeGuid"=118962B441E9282349A21EA43ADEE816
|
||||
CustomProperties Pin (PinId=3DD8E64049B1CD7AF21517B9C9C0E52E,PinName="Some_§-AStruct",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/Engine.UserDefinedStruct'"/Game/StarterContent/Blueprints/Some_§-AStruct.Some_§-AStruct"',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=97BAE50C41A8924F13A6E9B6EB9F83C8,PinName="FirstVariable_1_13DD7A0E491E619509C7408F7D8C4071",PinFriendlyName="First.Variable",PinToolTip="First. Variable\nBoolean",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="False",AutogeneratedDefaultValue="False",PersistentGuid=13DD7A0E491E619509C7408F7D8C4071,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=94B8DE014A527EBDC91E48A6E95D8D2E,PinName="Second-Variable_5_B897B051478F270D20FF29B3BC3B5A8C",PinFriendlyName="Second-Variable",PinToolTip="Second- Variable\nArray of Transforms",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Transform"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=Array,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=B897B051478F270D20FF29B3BC3B5A8C,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=True,bAdvancedView=False,bOrphanedPin=False,)
|
||||
End Object
|
||||
`,
|
||||
size: [17.5, 6],
|
||||
color: Configuration.nodeColors.darkBlue,
|
||||
icon: SVGIcon.makeStruct,
|
||||
pins: 3,
|
||||
pinNames: ["First.Variable", "Second-Variable", "Some_§-AStruct"],
|
||||
delegate: false,
|
||||
development: false,
|
||||
},
|
||||
]
|
||||
|
||||
generateNodeTests(tests)
|
||||
|
||||
@@ -83,7 +83,7 @@ function generateNodeTest(nodeTest, getBlueprint) {
|
||||
it("Maintains the order of attributes", () => {
|
||||
getBlueprint().selectAll()
|
||||
const value = getBlueprint().template.getCopyInputObject().getSerializedText()
|
||||
const words = value.split("\n").map(row => row.match(/\s*(\w+(\s+\w+)*).+/)?.[1]).filter(v => v?.length > 0)
|
||||
const words = value.split("\n").map(row => row.match(/\s*("?\w+(\s+\w+)*).+/)?.[1]).filter(v => v?.length > 0)
|
||||
expect(value).to.match(getFirstWordOrder(words))
|
||||
})
|
||||
if (nodeTest.additionalTest) {
|
||||
|
||||
37
dist/ueblueprint.js
vendored
37
dist/ueblueprint.js
vendored
@@ -32,7 +32,8 @@ var t$1;const i$2=window,s$1=i$2.trustedTypes,e$1=s$1?s$1.createPolicy("lit-html
|
||||
class Configuration {
|
||||
static nodeColors = {
|
||||
blue: i$3`84, 122, 156`,
|
||||
darkBlue: i$3`19, 100, 137`,
|
||||
darkBlue: i$3`32, 80, 128`,
|
||||
darkTurquoise: i$3`19, 100, 137`,
|
||||
gray: i$3`150,150,150`,
|
||||
green: i$3`95, 129, 90`,
|
||||
lime: i$3`150, 160, 30`,
|
||||
@@ -166,6 +167,7 @@ class Configuration {
|
||||
makeArray: "/Script/BlueprintGraph.K2Node_MakeArray",
|
||||
makeMap: "/Script/BlueprintGraph.K2Node_MakeMap",
|
||||
makeSet: "/Script/BlueprintGraph.K2Node_MakeSet",
|
||||
makeStruct: "/Script/BlueprintGraph.K2Node_MakeStruct",
|
||||
materialExpressionConstant: "/Script/Engine.MaterialExpressionConstant",
|
||||
materialExpressionConstant2Vector: "/Script/Engine.MaterialExpressionConstant2Vector",
|
||||
materialExpressionConstant3Vector: "/Script/Engine.MaterialExpressionConstant3Vector",
|
||||
@@ -3100,6 +3102,9 @@ class ObjectEntity extends IEntity {
|
||||
G: {
|
||||
type: Number,
|
||||
},
|
||||
StructType: {
|
||||
type: ObjectReferenceEntity,
|
||||
},
|
||||
MaterialExpression: {
|
||||
type: ObjectReferenceEntity,
|
||||
},
|
||||
@@ -3289,6 +3294,7 @@ class ObjectEntity extends IEntity {
|
||||
/** @type {ObjectReferenceEntity?} */ this.ProxyClass;
|
||||
/** @type {Number?} */ this.R;
|
||||
/** @type {Number?} */ this.G;
|
||||
/** @type {ObjectReferenceEntity?} */ this.StructType;
|
||||
/** @type {ObjectReferenceEntity?} */ this.MaterialExpression;
|
||||
/** @type {ObjectReferenceEntity?} */ this.MaterialExpressionComment;
|
||||
/** @type {SymbolEntity?} */ this.MoveMode;
|
||||
@@ -3545,6 +3551,10 @@ class ObjectEntity extends IEntity {
|
||||
return "Return Node"
|
||||
case Configuration.paths.ifThenElse:
|
||||
return "Branch"
|
||||
case Configuration.paths.makeStruct:
|
||||
if (this.StructType) {
|
||||
return `Make ${this.StructType.getName()}`
|
||||
}
|
||||
case Configuration.paths.materialExpressionConstant:
|
||||
input ??= [this.getCustomproperties().find(pinEntity => pinEntity.PinName == "Value")?.DefaultValue];
|
||||
case Configuration.paths.materialExpressionConstant2Vector:
|
||||
@@ -3765,10 +3775,12 @@ class ObjectEntity extends IEntity {
|
||||
case Configuration.paths.materialExpressionConstant3Vector:
|
||||
case Configuration.paths.materialExpressionConstant4Vector:
|
||||
return Configuration.nodeColors.yellow
|
||||
case Configuration.paths.makeStruct:
|
||||
return Configuration.nodeColors.darkBlue
|
||||
case Configuration.paths.materialExpressionMaterialFunctionCall:
|
||||
return Configuration.nodeColors.blue
|
||||
case Configuration.paths.materialExpressionTextureSample:
|
||||
return Configuration.nodeColors.darkBlue
|
||||
return Configuration.nodeColors.darkTurquoise
|
||||
case Configuration.paths.materialExpressionTextureCoordinate:
|
||||
return Configuration.nodeColors.red
|
||||
}
|
||||
@@ -3844,6 +3856,7 @@ class ObjectEntity extends IEntity {
|
||||
case Configuration.paths.makeArray: return SVGIcon.makeArray
|
||||
case Configuration.paths.makeMap: return SVGIcon.makeMap
|
||||
case Configuration.paths.makeSet: return SVGIcon.makeSet
|
||||
case Configuration.paths.makeStruct: return SVGIcon.makeStruct
|
||||
case Configuration.paths.select: return SVGIcon.select
|
||||
case Configuration.paths.spawnActorFromClass: return SVGIcon.spawnActor
|
||||
case Configuration.paths.timeline: return SVGIcon.timer
|
||||
@@ -4091,15 +4104,6 @@ class Grammar {
|
||||
+ (min === 1 ? "*" : min === 2 ? "+" : `{${min},}`)
|
||||
)
|
||||
|
||||
static optWrappedIn = (source, l, r) =>
|
||||
Grammar.regexMap(
|
||||
new RegExp(
|
||||
l + "(" + source + ")" + r
|
||||
+ "|" + "(" + source + ")"
|
||||
),
|
||||
([_0, a, b]) => a ?? b
|
||||
)
|
||||
|
||||
static Regex = class {
|
||||
static ByteInteger = /0*(?:25[0-5]|2[0-4]\d|1?\d?\d)(?!\d|\.)/ // A integer between 0 and 255
|
||||
static HexDigit = /[0-9a-fA-F]/
|
||||
@@ -8366,8 +8370,17 @@ class PinTemplate extends ITemplate {
|
||||
}
|
||||
|
||||
renderName() {
|
||||
let name = this.element.getPinDisplayName();
|
||||
const nodeElement = this.element.nodeElement;
|
||||
const pinName = this.element.getPinName();
|
||||
if (
|
||||
nodeElement.getType() == Configuration.paths.makeStruct
|
||||
&& pinName == nodeElement.entity.StructType.getName()
|
||||
) {
|
||||
name = pinName;
|
||||
}
|
||||
return x`
|
||||
<span class="ueb-pin-name ueb-ellipsis-nowrap-text">${this.element.getPinDisplayName()}</span>
|
||||
<span class="ueb-pin-name ueb-ellipsis-nowrap-text">${name}</span>
|
||||
`
|
||||
}
|
||||
|
||||
|
||||
6
dist/ueblueprint.min.js
vendored
6
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -8,7 +8,8 @@ import { css } from "lit"
|
||||
export default class Configuration {
|
||||
static nodeColors = {
|
||||
blue: css`84, 122, 156`,
|
||||
darkBlue: css`19, 100, 137`,
|
||||
darkBlue: css`32, 80, 128`,
|
||||
darkTurquoise: css`19, 100, 137`,
|
||||
gray: css`150,150,150`,
|
||||
green: css`95, 129, 90`,
|
||||
lime: css`150, 160, 30`,
|
||||
@@ -142,6 +143,7 @@ export default class Configuration {
|
||||
makeArray: "/Script/BlueprintGraph.K2Node_MakeArray",
|
||||
makeMap: "/Script/BlueprintGraph.K2Node_MakeMap",
|
||||
makeSet: "/Script/BlueprintGraph.K2Node_MakeSet",
|
||||
makeStruct: "/Script/BlueprintGraph.K2Node_MakeStruct",
|
||||
materialExpressionConstant: "/Script/Engine.MaterialExpressionConstant",
|
||||
materialExpressionConstant2Vector: "/Script/Engine.MaterialExpressionConstant2Vector",
|
||||
materialExpressionConstant3Vector: "/Script/Engine.MaterialExpressionConstant3Vector",
|
||||
|
||||
@@ -151,6 +151,9 @@ export default class ObjectEntity extends IEntity {
|
||||
G: {
|
||||
type: Number,
|
||||
},
|
||||
StructType: {
|
||||
type: ObjectReferenceEntity,
|
||||
},
|
||||
MaterialExpression: {
|
||||
type: ObjectReferenceEntity,
|
||||
},
|
||||
@@ -340,6 +343,7 @@ export default class ObjectEntity extends IEntity {
|
||||
/** @type {ObjectReferenceEntity?} */ this.ProxyClass
|
||||
/** @type {Number?} */ this.R
|
||||
/** @type {Number?} */ this.G
|
||||
/** @type {ObjectReferenceEntity?} */ this.StructType
|
||||
/** @type {ObjectReferenceEntity?} */ this.MaterialExpression
|
||||
/** @type {ObjectReferenceEntity?} */ this.MaterialExpressionComment
|
||||
/** @type {SymbolEntity?} */ this.MoveMode
|
||||
@@ -596,6 +600,10 @@ export default class ObjectEntity extends IEntity {
|
||||
return "Return Node"
|
||||
case Configuration.paths.ifThenElse:
|
||||
return "Branch"
|
||||
case Configuration.paths.makeStruct:
|
||||
if (this.StructType) {
|
||||
return `Make ${this.StructType.getName()}`
|
||||
}
|
||||
case Configuration.paths.materialExpressionConstant:
|
||||
input ??= [this.getCustomproperties().find(pinEntity => pinEntity.PinName == "Value")?.DefaultValue]
|
||||
case Configuration.paths.materialExpressionConstant2Vector:
|
||||
@@ -816,10 +824,12 @@ export default class ObjectEntity extends IEntity {
|
||||
case Configuration.paths.materialExpressionConstant3Vector:
|
||||
case Configuration.paths.materialExpressionConstant4Vector:
|
||||
return Configuration.nodeColors.yellow
|
||||
case Configuration.paths.makeStruct:
|
||||
return Configuration.nodeColors.darkBlue
|
||||
case Configuration.paths.materialExpressionMaterialFunctionCall:
|
||||
return Configuration.nodeColors.blue
|
||||
case Configuration.paths.materialExpressionTextureSample:
|
||||
return Configuration.nodeColors.darkBlue
|
||||
return Configuration.nodeColors.darkTurquoise
|
||||
case Configuration.paths.materialExpressionTextureCoordinate:
|
||||
return Configuration.nodeColors.red
|
||||
}
|
||||
@@ -895,6 +905,7 @@ export default class ObjectEntity extends IEntity {
|
||||
case Configuration.paths.makeArray: return SVGIcon.makeArray
|
||||
case Configuration.paths.makeMap: return SVGIcon.makeMap
|
||||
case Configuration.paths.makeSet: return SVGIcon.makeSet
|
||||
case Configuration.paths.makeStruct: return SVGIcon.makeStruct
|
||||
case Configuration.paths.select: return SVGIcon.select
|
||||
case Configuration.paths.spawnActorFromClass: return SVGIcon.spawnActor
|
||||
case Configuration.paths.timeline: return SVGIcon.timer
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { html, nothing } from "lit"
|
||||
import Configuration from "../../Configuration.js"
|
||||
import ITemplate from "../ITemplate.js"
|
||||
import MouseCreateLink from "../../input/mouse/MouseCreateLink.js"
|
||||
import SVGIcon from "../../SVGIcon.js"
|
||||
@@ -100,8 +101,17 @@ export default class PinTemplate extends ITemplate {
|
||||
}
|
||||
|
||||
renderName() {
|
||||
let name = this.element.getPinDisplayName()
|
||||
const nodeElement = this.element.nodeElement
|
||||
const pinName = this.element.getPinName()
|
||||
if (
|
||||
nodeElement.getType() == Configuration.paths.makeStruct
|
||||
&& pinName == nodeElement.entity.StructType.getName()
|
||||
) {
|
||||
name = pinName
|
||||
}
|
||||
return html`
|
||||
<span class="ueb-pin-name ueb-ellipsis-nowrap-text">${this.element.getPinDisplayName()}</span>
|
||||
<span class="ueb-pin-name ueb-ellipsis-nowrap-text">${name}</span>
|
||||
`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user