mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-22 14:17:30 +08:00
WIP
This commit is contained in:
282
dist/ueblueprint.js
vendored
282
dist/ueblueprint.js
vendored
File diff suppressed because one or more lines are too long
12
dist/ueblueprint.min.js
vendored
12
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -142,7 +142,10 @@ export default class ObjectEntity extends IEntity {
|
|||||||
ScriptVariables: ArrayEntity.flagInlined().of(ScriptVariableEntity),
|
ScriptVariables: ArrayEntity.flagInlined().of(ScriptVariableEntity),
|
||||||
Node: MirroredEntity.of(ObjectReferenceEntity),
|
Node: MirroredEntity.of(ObjectReferenceEntity),
|
||||||
ExportedNodes: StringEntity,
|
ExportedNodes: StringEntity,
|
||||||
CustomProperties: ArrayEntity.of(AlternativesEntity.accepting(PinEntity, UnknownPinEntity)).withDefault().flagSilent(),
|
CustomProperties: ArrayEntity
|
||||||
|
.of(AlternativesEntity.accepting(PinEntity, UnknownPinEntity))
|
||||||
|
.withDefault()
|
||||||
|
.flagSilent(),
|
||||||
}
|
}
|
||||||
static customPropertyGrammar = P.seq(
|
static customPropertyGrammar = P.seq(
|
||||||
P.reg(/CustomProperties\s+/),
|
P.reg(/CustomProperties\s+/),
|
||||||
@@ -367,16 +370,41 @@ export default class ObjectEntity extends IEntity {
|
|||||||
? outputIndex++
|
? outputIndex++
|
||||||
: i
|
: i
|
||||||
})
|
})
|
||||||
const reference = this.ExportPath?.valueOf()
|
|
||||||
if (reference?.path.endsWith(this.Name?.toString())) {
|
// Mirror name part of the object in ExportPath
|
||||||
|
const exportPath = this.ExportPath?.valueOf()
|
||||||
|
if (exportPath?.path.endsWith(this.Name?.toString())) {
|
||||||
const mirroredEntity = /** @type {typeof ObjectEntity} */(this.constructor).attributes.ExportPath
|
const mirroredEntity = /** @type {typeof ObjectEntity} */(this.constructor).attributes.ExportPath
|
||||||
const objectReferenceEntity = /** @type {typeof ObjectReferenceEntity} */(mirroredEntity.type)
|
const prefix = exportPath.path.substring(0, exportPath.path.length - this.Name.toString().length)
|
||||||
const nameLength = this.Name.valueOf().length
|
this.ExportPath = new mirroredEntity(
|
||||||
this.ExportPath = new mirroredEntity(() => new objectReferenceEntity(
|
() => new (mirroredEntity.type)(exportPath.type, prefix + this.Name.toString(), exportPath.full)
|
||||||
reference.type,
|
)
|
||||||
reference.path.substring(0, reference.path.length - nameLength) + this.Name,
|
}
|
||||||
reference.full,
|
|
||||||
))
|
// Mirror name part of the nested object in ExportPath
|
||||||
|
if (this.Name) {
|
||||||
|
for (const k of Object.keys(this)) {
|
||||||
|
if (!k.startsWith(Configuration.subObjectAttributeNamePrefix)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
/** @type {ObjectEntity} */
|
||||||
|
const subObject = this[k]
|
||||||
|
if (!subObject.ExportPath?.valueOf().path.includes(this.Name.toString())) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const originalExportPath = subObject.ExportPath.valueOf()
|
||||||
|
const position = originalExportPath.path.indexOf(this.Name.toString())
|
||||||
|
const prefix = originalExportPath.path.substring(0, position)
|
||||||
|
const suffix = originalExportPath.path.substring(position + this.Name.toString().length)
|
||||||
|
const mirroredEntity = /** @type {typeof ObjectEntity} */(subObject.constructor).attributes.ExportPath
|
||||||
|
subObject.ExportPath = new mirroredEntity(
|
||||||
|
() => new (mirroredEntity.type)(
|
||||||
|
originalExportPath.type,
|
||||||
|
prefix + (this.Name ?? "").toString() + suffix,
|
||||||
|
originalExportPath.full
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -666,9 +694,10 @@ export default class ObjectEntity extends IEntity {
|
|||||||
attributeSeparator = Self.attributeSeparator,
|
attributeSeparator = Self.attributeSeparator,
|
||||||
wrap = Self.wrap,
|
wrap = Self.wrap,
|
||||||
) {
|
) {
|
||||||
|
const isSelfOverriden = Self !== this.constructor
|
||||||
const deeperIndentation = indentation + Configuration.indentation
|
const deeperIndentation = indentation + Configuration.indentation
|
||||||
const initial_trailing = this.trailing
|
const initial_trailing = this.trailing
|
||||||
this.trailing = false
|
this.trailing = true
|
||||||
const content = super.doSerialize(insideString, deeperIndentation, Self, printKey, keySeparator, attributeSeparator, wrap)
|
const content = super.doSerialize(insideString, deeperIndentation, Self, printKey, keySeparator, attributeSeparator, wrap)
|
||||||
this.trailing = initial_trailing
|
this.trailing = initial_trailing
|
||||||
let result = indentation + "Begin Object"
|
let result = indentation + "Begin Object"
|
||||||
@@ -696,21 +725,21 @@ export default class ObjectEntity extends IEntity {
|
|||||||
? ` ExportPath${keySeparator}${this.ExportPath.serialize(insideString)}`
|
? ` ExportPath${keySeparator}${this.ExportPath.serialize(insideString)}`
|
||||||
: ""
|
: ""
|
||||||
)
|
)
|
||||||
+ (content ? attributeSeparator + content : "")
|
+ attributeSeparator
|
||||||
|
+ content
|
||||||
+ (Self.attributes.CustomProperties.ignored !== true && this.CustomProperties.ignored !== true
|
+ (Self.attributes.CustomProperties.ignored !== true && this.CustomProperties.ignored !== true
|
||||||
? this.getCustomproperties()
|
? this.getCustomproperties()
|
||||||
.map(pin =>
|
.map(pin =>
|
||||||
attributeSeparator
|
deeperIndentation
|
||||||
+ deeperIndentation
|
|
||||||
+ printKey("CustomProperties ")
|
+ printKey("CustomProperties ")
|
||||||
+ pin.serialize(insideString)
|
+ pin.serialize(insideString)
|
||||||
|
+ attributeSeparator
|
||||||
)
|
)
|
||||||
.join("")
|
.join("")
|
||||||
: ""
|
: ""
|
||||||
)
|
)
|
||||||
+ attributeSeparator
|
|
||||||
+ indentation + "End Object"
|
+ indentation + "End Object"
|
||||||
+ (this.trailing ? attributeSeparator : "")
|
+ (isSelfOverriden && Self.trailing || this.trailing ? attributeSeparator : "")
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,27 +29,27 @@ export default class ObjectReferenceEntity extends IEntity {
|
|||||||
this.#path = value
|
this.#path = value
|
||||||
}
|
}
|
||||||
|
|
||||||
#full
|
#serializer
|
||||||
get full() {
|
get full() {
|
||||||
return this.#full
|
return this.#serializer
|
||||||
}
|
}
|
||||||
set full(value) {
|
set full(value) {
|
||||||
this.#full = value
|
this.#serializer = value
|
||||||
}
|
}
|
||||||
|
|
||||||
#name = ""
|
#name = ""
|
||||||
|
|
||||||
/** @param {(t: String, p: String) => String} full */
|
/** @param {(t: String, p: String) => String} serializer */
|
||||||
constructor(
|
constructor(
|
||||||
type = "None",
|
type = "None",
|
||||||
path = "",
|
path = "",
|
||||||
full = type.includes("/") || path
|
serializer = type.includes("/") || path
|
||||||
? (t, p) => `"${t + (p ? (`'${p}'`) : "")}"`
|
? (t, p) => `"${t + (p ? (`'${p}'`) : "")}"`
|
||||||
: (t, p) => t) {
|
: (t, p) => t) {
|
||||||
super()
|
super()
|
||||||
this.#type = type
|
this.#type = type
|
||||||
this.#path = path
|
this.#path = path
|
||||||
this.#full = full
|
this.#serializer = serializer
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {P<ObjectReferenceEntity>} */
|
/** @returns {P<ObjectReferenceEntity>} */
|
||||||
|
|||||||
@@ -143,7 +143,9 @@ export default class PinTemplate extends ITemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isInputRendered() {
|
isInputRendered() {
|
||||||
return this.element.isInput() && !this.element.entity.PinType.bIsReference?.valueOf()
|
return this.element.isInput()
|
||||||
|
&& !this.element.entity.bDefaultValueIsIgnored?.valueOf()
|
||||||
|
&& !this.element.entity.PinType.bIsReference?.valueOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
renderInput() {
|
renderInput() {
|
||||||
|
|||||||
@@ -26,10 +26,10 @@
|
|||||||
"homepage": "https://github.com/barsdeveloper/ueblueprint#readme",
|
"homepage": "https://github.com/barsdeveloper/ueblueprint#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "1.49",
|
"@playwright/test": "1.49",
|
||||||
"@rollup/plugin-commonjs": "^25",
|
"@rollup/plugin-commonjs": "^28",
|
||||||
"@rollup/plugin-node-resolve": "^15",
|
"@rollup/plugin-node-resolve": "^16",
|
||||||
"@rollup/plugin-terser": "^0",
|
"@rollup/plugin-terser": "^0",
|
||||||
"concurrently": "^8",
|
"concurrently": "^9",
|
||||||
"http-server": "^14",
|
"http-server": "^14",
|
||||||
"rollup": "^4 || ^3 || ^2",
|
"rollup": "^4 || ^3 || ^2",
|
||||||
"rollup-plugin-copy": "^3",
|
"rollup-plugin-copy": "^3",
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
"terser": "^5"
|
"terser": "^5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lit": "^2",
|
"lit": "^3",
|
||||||
"parsernostrum": "^1"
|
"parsernostrum": "^1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ test("Issue 27", async ({ blueprintPage }) => {
|
|||||||
CustomProperties Pin (PinId=424DC49B456B27D825A8F690E6CAA096,PinName="OutputPin",Direction="EGPD_Output",PinType.PinCategory="delegate",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(MemberParent="/Script/Engine.BlueprintGeneratedClass'/Game/Examples/BallShooter/Blueprints/BallShooterEnvironment.BallShooterEnvironment_C'",MemberName="CustomEvent",MemberGuid=8955D806490FF62840F229BD64AC0F8B),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_AssignDelegate_0 3C0089524CDDA9E63853BEA28156FACD,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
CustomProperties Pin (PinId=424DC49B456B27D825A8F690E6CAA096,PinName="OutputPin",Direction="EGPD_Output",PinType.PinCategory="delegate",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(MemberParent="/Script/Engine.BlueprintGeneratedClass'/Game/Examples/BallShooter/Blueprints/BallShooterEnvironment.BallShooterEnvironment_C'",MemberName="CustomEvent",MemberGuid=8955D806490FF62840F229BD64AC0F8B),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_AssignDelegate_0 3C0089524CDDA9E63853BEA28156FACD,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||||
End Object
|
End Object
|
||||||
`)
|
`)
|
||||||
const eventNode = await blueprintPage.blueprintLocator.locator("ueb-node").nth(0)
|
const eventNode = blueprintPage.blueprintLocator.locator("ueb-node").nth(0)
|
||||||
const knotNode = await blueprintPage.blueprintLocator.locator("ueb-node").nth(2)
|
const knotNode = blueprintPage.blueprintLocator.locator("ueb-node").nth(2)
|
||||||
const assignNode = await blueprintPage.blueprintLocator.locator("ueb-node").nth(1)
|
const assignNode = blueprintPage.blueprintLocator.locator("ueb-node").nth(1)
|
||||||
const pin1 = eventNode.locator("ueb-pin").nth(0)
|
const pin1 = eventNode.locator("ueb-pin").nth(0)
|
||||||
const pin2A = knotNode.locator("ueb-pin").nth(0)
|
const pin2A = knotNode.locator("ueb-pin").nth(0)
|
||||||
const pin2B = knotNode.locator("ueb-pin").nth(1)
|
const pin2B = knotNode.locator("ueb-pin").nth(1)
|
||||||
@@ -49,5 +49,5 @@ test("Issue 27", async ({ blueprintPage }) => {
|
|||||||
expect(await pin2A.evaluate(/** @param {PinElement} pin */ pin => pin.isLinked)).toBeTruthy()
|
expect(await pin2A.evaluate(/** @param {PinElement} pin */ pin => pin.isLinked)).toBeTruthy()
|
||||||
expect(await pin2B.evaluate(/** @param {PinElement} pin */ pin => pin.isLinked)).toBeTruthy()
|
expect(await pin2B.evaluate(/** @param {PinElement} pin */ pin => pin.isLinked)).toBeTruthy()
|
||||||
expect(await pin3.evaluate(/** @param {PinElement} pin */ pin => pin.isLinked)).toBeTruthy()
|
expect(await pin3.evaluate(/** @param {PinElement} pin */ pin => pin.isLinked)).toBeTruthy()
|
||||||
expect(await blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(2)
|
expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(2)
|
||||||
})
|
})
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user