Fix Niagara variables

This commit is contained in:
barsdeveloper
2024-12-18 18:44:20 +02:00
parent 3b68fb46a8
commit 2173e2b421
7 changed files with 176 additions and 31 deletions

86
dist/ueblueprint.js vendored
View File

@@ -596,10 +596,11 @@ class Utility {
/**
* @template T
* @param {Array<T>} reference
* @param {Array<T>} additional
* @param {T[]} reference
* @param {T[]} additional
* @param {(v: T) => void} adding - Process added element
* @param {(l: T, r: T) => Boolean} predicate
* @returns {T[]}
*/
static mergeArrays(reference = [], additional = [], predicate = (l, r) => l == r, adding = v => { }) {
let result = [];
@@ -628,7 +629,11 @@ class Utility {
}
// Append remaining the elements in the arrays and make it unique
result.push(...reference);
result.push(...additional.filter(vb => !result.some(vr => predicate(vr, vb))));
result.push(
...additional
.filter(vb => !result.some(vr => predicate(vr, vb)))
.map((v, k) => (adding(v), v))
);
return result
}
@@ -10275,7 +10280,6 @@ class BlueprintEntity extends ObjectEntity {
/** @type {Map<String, Number>} */
#objectEntitiesNameCounter = new Map()
#variableNames = new Set()
/** @type {ObjectEntity[]}" */
#objectEntities = []
@@ -10309,6 +10313,16 @@ class BlueprintEntity extends ObjectEntity {
return Configuration.nodeTitle(name, counter)
}
/** @param {String} name */
updateNameIndex(name) {
const match = name.match(/(.+)_(\d+)$/);
if (match) {
name = match[1];
const index = Number(match[2]);
this.#objectEntitiesNameCounter.set(name, Math.max(index, this.#objectEntitiesNameCounter.get(name) ?? 0));
}
}
/** @param {ObjectEntity} entity */
addObjectEntity(entity) {
if (!this.#objectEntities.includes(entity)) {
@@ -10352,6 +10366,29 @@ class BlueprintEntity extends ObjectEntity {
});
}
variable.path.replace(name, newName);
return newName
}
/**
* @param {ScriptVariableEntity} scriptVariableEntity
* @returns {String}
*/
variableName(scriptVariableEntity) {
return this[Configuration.subObjectAttributeNameFromReference(scriptVariableEntity.ScriptVariable, true)]
?.["Variable"]
?.["Name"]
?.toString()
}
/** @param {String} variableName */
variableIndex(variableName) {
let i = 0;
for (const v of this.ScriptVariables?.valueOf()) {
if (variableName == this.variableName(v)) {
return i
}
++i;
}
}
/** @param {ObjectEntity} entity */
@@ -10360,15 +10397,17 @@ class BlueprintEntity extends ObjectEntity {
// The entity does not add new variables
return this
}
const variableObjectNames = this.ScriptVariables.valueOf().map(v => v.ScriptVariable.getName());
let scriptVariables = Utility.mergeArrays(
this.ScriptVariables.valueOf(),
entity.ScriptVariables.valueOf(),
(l, r) => l.OriginalChangeId.value == r.OriginalChangeId.value,
(l, r) => this.variableName(l) == this.variableName(r),
added => {
const name = added.ScriptVariable.getName();
if (this.#variableNames.has(name)) {
this.renameScriptVariable(added.ScriptVariable, entity);
let name = added.ScriptVariable.getName();
if (variableObjectNames.includes(name)) {
name = this.renameScriptVariable(added.ScriptVariable, entity);
}
this.updateNameIndex(name);
}
);
if (scriptVariables.length === this.ScriptVariables.length) {
@@ -10376,6 +10415,7 @@ class BlueprintEntity extends ObjectEntity {
return this
}
scriptVariables.reverse();
const blueprintEntity = /** @type {typeof BlueprintEntity} */(this.constructor);
const entries = scriptVariables.concat(scriptVariables).map((v, i) => {
const name = Configuration.subObjectAttributeNameFromReference(
v.ScriptVariable,
@@ -10383,15 +10423,19 @@ class BlueprintEntity extends ObjectEntity {
);
const object = this[name] ?? entity[name];
return object ? [name, object] : null
}).filter(v => v);
})
.filter(v => v);
entries.push(
...Object.entries(this).filter(([k, v]) =>
!k.startsWith(Configuration.subObjectAttributeNamePrefix)
&& k !== "ExportedNodes"
),
["ScriptVariables", new (BlueprintEntity.attributes.ScriptVariables)(scriptVariables.reverse())]
["ScriptVariables", new (blueprintEntity.attributes.ScriptVariables)(scriptVariables.reverse())]
);
return new BlueprintEntity(Object.fromEntries(entries))
const result = new BlueprintEntity(Object.fromEntries(entries));
result.#objectEntitiesNameCounter = this.#objectEntitiesNameCounter;
result.#objectEntities = this.#objectEntities;
return result
}
/** @param {ObjectEntity[]} entities */
@@ -10434,17 +10478,32 @@ class NiagaraClipboardContent extends ObjectEntity {
const typePath = Configuration.paths.niagaraClipboardContent;
const name = blueprint.takeFreeName("NiagaraClipboardContent");
const exportPath = `/Engine/Transient.${name}`;
/** @type {Set<Number>} */
const variableIndexes = new Set();
let exported = "";
for (const node of nodes) {
if (node.exported) {
node.getPinEntities()
.map(pin => blueprint.variableIndex(pin.PinName.toString()))
.filter(v => v != null)
.forEach(i => variableIndexes.add(i));
exported += node.serialize();
}
}
nodes.filter(n => !n.exported).map(n => n.serialize());
const scriptVariables = blueprint.ScriptVariables.valueOf().filter((v, i) => variableIndexes.has(i));
const variableObjects = scriptVariables.concat(scriptVariables).map((v, i) => {
const name = Configuration.subObjectAttributeNameFromReference(
v.ScriptVariable,
i >= scriptVariables.length // First take all the small objects then all name only
);
return [name, blueprint[name]]
});
super({
Class: new ObjectReferenceEntity(typePath),
Name: new StringEntity(name),
...Object.fromEntries(variableObjects),
ExportPath: new ObjectReferenceEntity(typePath, exportPath),
ScriptVariables: new (NiagaraClipboardContent.attributes.ScriptVariables)(scriptVariables),
ExportedNodes: new StringEntity(btoa(exported))
});
}
@@ -11571,6 +11630,8 @@ class Blueprint extends IElement {
for (const element of graphElements) {
element.blueprint = this;
if (element instanceof NodeElement && !this.nodes.includes(element)) {
const name = element.entity.getObjectName();
this.entity.updateNameIndex(name);
if (element.getType() == Configuration.paths.niagaraClipboardContent) {
this.entity = this.entity.mergeWith(element.entity);
const additionalSerialization = atob(element.entity.ExportedNodes.toString());
@@ -11578,7 +11639,6 @@ class Blueprint extends IElement {
.forEach(node => node.entity.exported = true);
continue
}
const name = element.entity.getObjectName();
const homonym = this.entity.getHomonymObjectEntity(element.entity);
if (homonym) {
const newName = this.entity.takeFreeName(name);

File diff suppressed because one or more lines are too long

View File

@@ -409,6 +409,8 @@ export default class Blueprint extends IElement {
for (const element of graphElements) {
element.blueprint = this
if (element instanceof NodeElement && !this.nodes.includes(element)) {
const name = element.entity.getObjectName()
this.entity.updateNameIndex(name)
if (element.getType() == Configuration.paths.niagaraClipboardContent) {
this.entity = this.entity.mergeWith(element.entity)
const additionalSerialization = atob(element.entity.ExportedNodes.toString())
@@ -416,7 +418,6 @@ export default class Blueprint extends IElement {
.forEach(node => node.entity.exported = true)
continue
}
const name = element.entity.getObjectName()
const homonym = this.entity.getHomonymObjectEntity(element.entity)
if (homonym) {
const newName = this.entity.takeFreeName(name)

View File

@@ -147,10 +147,11 @@ export default class Utility {
/**
* @template T
* @param {Array<T>} reference
* @param {Array<T>} additional
* @param {T[]} reference
* @param {T[]} additional
* @param {(v: T) => void} adding - Process added element
* @param {(l: T, r: T) => Boolean} predicate
* @returns {T[]}
*/
static mergeArrays(reference = [], additional = [], predicate = (l, r) => l == r, adding = v => { }) {
let result = []
@@ -179,7 +180,11 @@ export default class Utility {
}
// Append remaining the elements in the arrays and make it unique
result.push(...reference)
result.push(...additional.filter(vb => !result.some(vr => predicate(vr, vb))))
result.push(
...additional
.filter(vb => !result.some(vr => predicate(vr, vb)))
.map((v, k) => (adding(v), v))
)
return result
}

View File

@@ -1,12 +1,12 @@
import Configuration from "../Configuration.js"
import Utility from "../Utility.js"
import ObjectEntity from "./ObjectEntity.js"
import ScriptVariableEntity from "./ScriptVariableEntity.js"
export default class BlueprintEntity extends ObjectEntity {
/** @type {Map<String, Number>} */
#objectEntitiesNameCounter = new Map()
#variableNames = new Set()
/** @type {ObjectEntity[]}" */
#objectEntities = []
@@ -40,6 +40,16 @@ export default class BlueprintEntity extends ObjectEntity {
return Configuration.nodeTitle(name, counter)
}
/** @param {String} name */
updateNameIndex(name) {
const match = name.match(/(.+)_(\d+)$/)
if (match) {
name = match[1]
const index = Number(match[2])
this.#objectEntitiesNameCounter.set(name, Math.max(index, this.#objectEntitiesNameCounter.get(name) ?? 0))
}
}
/** @param {ObjectEntity} entity */
addObjectEntity(entity) {
if (!this.#objectEntities.includes(entity)) {
@@ -83,6 +93,29 @@ export default class BlueprintEntity extends ObjectEntity {
})
}
variable.path.replace(name, newName)
return newName
}
/**
* @param {ScriptVariableEntity} scriptVariableEntity
* @returns {String}
*/
variableName(scriptVariableEntity) {
return this[Configuration.subObjectAttributeNameFromReference(scriptVariableEntity.ScriptVariable, true)]
?.["Variable"]
?.["Name"]
?.toString()
}
/** @param {String} variableName */
variableIndex(variableName) {
let i = 0
for (const v of this.ScriptVariables?.valueOf()) {
if (variableName == this.variableName(v)) {
return i
}
++i
}
}
/** @param {ObjectEntity} entity */
@@ -91,15 +124,17 @@ export default class BlueprintEntity extends ObjectEntity {
// The entity does not add new variables
return this
}
const variableObjectNames = this.ScriptVariables.valueOf().map(v => v.ScriptVariable.getName())
let scriptVariables = Utility.mergeArrays(
this.ScriptVariables.valueOf(),
entity.ScriptVariables.valueOf(),
(l, r) => l.OriginalChangeId.value == r.OriginalChangeId.value,
(l, r) => this.variableName(l) == this.variableName(r),
added => {
const name = added.ScriptVariable.getName()
if (this.#variableNames.has(name)) {
this.renameScriptVariable(added.ScriptVariable, entity)
let name = added.ScriptVariable.getName()
if (variableObjectNames.includes(name)) {
name = this.renameScriptVariable(added.ScriptVariable, entity)
}
this.updateNameIndex(name)
}
)
if (scriptVariables.length === this.ScriptVariables.length) {
@@ -107,6 +142,7 @@ export default class BlueprintEntity extends ObjectEntity {
return this
}
scriptVariables.reverse()
const blueprintEntity = /** @type {typeof BlueprintEntity} */(this.constructor)
const entries = scriptVariables.concat(scriptVariables).map((v, i) => {
const name = Configuration.subObjectAttributeNameFromReference(
v.ScriptVariable,
@@ -114,15 +150,19 @@ export default class BlueprintEntity extends ObjectEntity {
)
const object = this[name] ?? entity[name]
return object ? [name, object] : null
}).filter(v => v)
})
.filter(v => v)
entries.push(
...Object.entries(this).filter(([k, v]) =>
!k.startsWith(Configuration.subObjectAttributeNamePrefix)
&& k !== "ExportedNodes"
),
["ScriptVariables", new (BlueprintEntity.attributes.ScriptVariables)(scriptVariables.reverse())]
["ScriptVariables", new (blueprintEntity.attributes.ScriptVariables)(scriptVariables.reverse())]
)
return new BlueprintEntity(Object.fromEntries(entries))
const result = new BlueprintEntity(Object.fromEntries(entries))
result.#objectEntitiesNameCounter = this.#objectEntitiesNameCounter
result.#objectEntities = this.#objectEntities
return result
}
/** @param {ObjectEntity[]} entities */

View File

@@ -13,17 +13,32 @@ export default class NiagaraClipboardContent extends ObjectEntity {
const typePath = Configuration.paths.niagaraClipboardContent
const name = blueprint.takeFreeName("NiagaraClipboardContent")
const exportPath = `/Engine/Transient.${name}`
/** @type {Set<Number>} */
const variableIndexes = new Set()
let exported = ""
for (const node of nodes) {
if (node.exported) {
node.getPinEntities()
.map(pin => blueprint.variableIndex(pin.PinName.toString()))
.filter(v => v != null)
.forEach(i => variableIndexes.add(i))
exported += node.serialize()
}
}
const result = nodes.filter(n => !n.exported).map(n => n.serialize())
const scriptVariables = blueprint.ScriptVariables.valueOf().filter((v, i) => variableIndexes.has(i))
const variableObjects = scriptVariables.concat(scriptVariables).map((v, i) => {
const name = Configuration.subObjectAttributeNameFromReference(
v.ScriptVariable,
i >= scriptVariables.length // First take all the small objects then all name only
)
return [name, blueprint[name]]
})
super({
Class: new ObjectReferenceEntity(typePath),
Name: new StringEntity(name),
...Object.fromEntries(variableObjects),
ExportPath: new ObjectReferenceEntity(typePath, exportPath),
ScriptVariables: new (NiagaraClipboardContent.attributes.ScriptVariables)(scriptVariables),
ExportedNodes: new StringEntity(btoa(exported))
})
}

View File

@@ -1,4 +1,5 @@
import { test, expect } from "./fixtures/test.js"
import Utility from "../js/Utility.js"
import { expect, test } from "./fixtures/test.js"
/**
* @param {String} source
@@ -26,7 +27,6 @@ const serialized = (source, rename = "Blueprint") => {
.replaceAll(name, rename)
}
test.describe.configure({ mode: 'parallel' })
test.describe("Niagara ScriptVariables", () => {
test.beforeEach(async ({ blueprintPage }) => {
@@ -327,5 +327,29 @@ test.describe("Niagara ScriptVariables", () => {
`
expect(await blueprintPage.blueprintLocator.evaluate(blueprint => blueprint.entity.serialize()))
.toEqual(serialized(source))
await blueprintPage.removeNodes()
source = String.raw`
Begin Object Class=/Script/NiagaraEditor.NiagaraClipboardContent Name="NiagaraClipboardContent_16" ExportPath="/Script/NiagaraEditor.NiagaraClipboardContent'/Engine/Transient.NiagaraClipboardContent_16'"
Begin Object Class=/Script/NiagaraEditor.NiagaraScriptVariable Name="NiagaraScriptVariable_10" ExportPath="/Script/NiagaraEditor.NiagaraScriptVariable'/Engine/Transient.NiagaraClipboardContent_16:NiagaraScriptVariable_10'"
End Object
Begin Object Name="NiagaraScriptVariable_10" ExportPath="/Script/NiagaraEditor.NiagaraScriptVariable'/Engine/Transient.NiagaraClipboardContent_16:NiagaraScriptVariable_10'"
Variable=(VarData=(0,0,0,0),Name="Particles.SubImageIndex",TypeDefHandle=(RegisteredTypeIndex=83))
Metadata=(Description=NSLOCTEXT("", "A6EEC0624C1820790D5859A816C48DF0", "A value from 0 to the number of entries in the table of SubUV images."),VariableGuid=FD5D89194EA839DE285E639670017225)
DefaultValueVariant=(Bytes=(0,0,0,0),CurrentMode=Bytes)
bSubscribedToParameterDefinitions=True
ChangeId=F1627BE74919FE97C923DDB4710A9FE7
End Object
ScriptVariables(0)=(ScriptVariable="/Script/NiagaraEditor.NiagaraScriptVariable'NiagaraScriptVariable_10'",OriginalChangeId=F1627BE74919FE97C923DDB4710A9FE7)
ExportedNodes="QmVnaW4gT2JqZWN0IENsYXNzPS9TY3JpcHQvTmlhZ2FyYUVkaXRvci5OaWFnYXJhTm9kZVBhcmFtZXRlck1hcFNldCBOYW1lPSJOaWFnYXJhTm9kZVBhcmFtZXRlck1hcFNldF8xIiBFeHBvcnRQYXRoPSIvU2NyaXB0L05pYWdhcmFFZGl0b3IuTmlhZ2FyYU5vZGVQYXJhbWV0ZXJNYXBTZXQnL0VuZ2luZS9UcmFuc2llbnQuTmV3TmlhZ2FyYVNjcmlwdDI6TmlhZ2FyYVNjcmlwdFNvdXJjZV8wLk5pYWdhcmFHcmFwaF8wLk5pYWdhcmFOb2RlUGFyYW1ldGVyTWFwU2V0XzEnIgogICBDaGFuZ2VJZD0yQjhENTgyRjlFQjM0OUREQkMyRUU1MThCNzdENEI4RQ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eXBlLlBpbkNhdGVnb3J5PSJNaXNjIixQaW5UeXBlLlBpblN1YkNhdGVnb3J5PSJEeW5hbWljQWRkUGluIixQaW5UeXBlLlBpblN1YkNhdGVnb3J5T2JqZWN0PU5vbmUsUGluVHlwZS5QaW5TdWJDYXRlZ29yeU1lbWJlclJlZmVyZW5jZT0oKSxQaW5UeXBlLlBpblZhbHVlVHlwZT0oKSxQaW5UeXBlLkNvbnRhaW5lclR5cGU9Tm9uZSxQaW5UeXBlLmJJc1JlZmVyZW5jZT1GYWxzZSxQaW5UeXBlLmJJc0NvbnN0PUZhbHNlLFBpblR5cGUuYklzV2Vha1BvaW50ZXI9RmFsc2UsUGluVHlwZS5iSXNVT2JqZWN0V3JhcHBlcj1GYWxzZSxQaW5UeXBlLmJTZXJpYWxpemVBc1NpbmdsZVByZWNpc2lvbkZsb2F0PUZhbHNlLFBlcnNpc3RlbnRHdWlkPTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwLGJIaWRkZW49RmFsc2UsYk5vdENvbm5lY3RhYmxlPUZhbHNlLGJEZWZhdWx0VmFsdWVJc1JlYWRPbmx5PUZhbHNlLGJEZWZhdWx0VmFsdWVJc0lnbm9yZWQ9RmFsc2UsYkFkdmFuY2VkVmlldz1GYWxzZSxiT3JwaGFuZWRQaW49RmFsc2UsKQ0KRW5kIE9iamVjdA0K"
End Object
`
await blueprintPage.paste(source)
const expectedWords = source
.split("\n")
.map(row => row.match(/\s*("?\w+(\s+\w+)*).+/)?.[1])
.filter(v => v?.length > 0)
source = await blueprintPage.getSerializedNodes()
expect(source).toMatch(Utility.getFirstWordOrder(expectedWords))
})
})