mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-19 12:27:39 +08:00
Fixing mirrored ExportPath
This commit is contained in:
55
dist/ueblueprint.js
vendored
55
dist/ueblueprint.js
vendored
@@ -6642,36 +6642,39 @@ class ObjectEntity extends IEntity {
|
||||
});
|
||||
|
||||
// Mirror name part of the object in ExportPath
|
||||
const originalName = this.Name?.toString();
|
||||
const exportPath = this.ExportPath?.valueOf();
|
||||
if (exportPath?.path.endsWith(this.Name?.toString())) {
|
||||
if (originalName && exportPath?.path.endsWith(originalName)) {
|
||||
const mirroredEntity = /** @type {typeof ObjectEntity} */(this.constructor).attributes.ExportPath;
|
||||
const prefix = exportPath.path.substring(0, exportPath.path.length - this.Name.toString().length);
|
||||
this.ExportPath = new mirroredEntity(
|
||||
() => new (mirroredEntity.type)(exportPath.type, prefix + this.Name.toString(), exportPath.full)
|
||||
() => new (mirroredEntity.type)(
|
||||
exportPath.type,
|
||||
exportPath.path.replace(originalName, (this.Name ?? "")?.toString()),
|
||||
exportPath.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)) {
|
||||
if (originalName) {
|
||||
const values = Object.values(this);
|
||||
for (let i = 0; i < values.length; ++i) {
|
||||
const value = values[i];
|
||||
if (value instanceof ObjectEntity) {
|
||||
values.push(...Object.values(value));
|
||||
if (!value.ExportPath?.valueOf(this).path.includes(originalName)) {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
/** @type {ObjectEntity} */
|
||||
const subObject = this[k];
|
||||
if (!subObject.ExportPath?.valueOf(this).path.includes(this.Name.toString())) {
|
||||
continue
|
||||
}
|
||||
const originalExportPath = subObject.ExportPath.valueOf(this);
|
||||
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(
|
||||
const mirroredEntity = /** @type {typeof ObjectEntity} */(value.constructor).attributes.ExportPath;
|
||||
const exportPath = value.ExportPath?.valueOf();
|
||||
value.ExportPath = new mirroredEntity(
|
||||
(self = this) => new (mirroredEntity.type)(
|
||||
originalExportPath.type,
|
||||
prefix + (self.Name ?? "").toString() + suffix,
|
||||
originalExportPath.full
|
||||
exportPath.type,
|
||||
exportPath.path.replace(originalName, (this.Name ?? "")?.toString()),
|
||||
exportPath.full
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -10172,8 +10175,8 @@ class NodeElement extends ISelectableDraggableElement {
|
||||
"Name",
|
||||
/** @param {InstanceType<typeof ObjectEntity.attributes.Name>} newName */
|
||||
newName => {
|
||||
this.#redirectLinksBeforeRename(newName.value);
|
||||
this.nodeTitle = newName.value;
|
||||
this.#redirectLinksBeforeRename(newName?.toString());
|
||||
this.nodeTitle = newName?.toString();
|
||||
this.nodeDisplayName = nodeTitle(entity);
|
||||
}
|
||||
);
|
||||
@@ -11634,9 +11637,11 @@ class Blueprint extends IElement {
|
||||
this.entity.updateNameIndex(name);
|
||||
if (element.getType() == Configuration.paths.niagaraClipboardContent) {
|
||||
this.entity = this.entity.mergeWith(element.entity);
|
||||
const additionalSerialization = atob(element.entity.ExportedNodes.toString());
|
||||
this.template.getPasteInputObject().pasted(additionalSerialization)
|
||||
.forEach(node => node.entity.exported = true);
|
||||
const additionalSerialization = atob(element.entity.ExportedNodes?.toString() ?? "");
|
||||
if (additionalSerialization) {
|
||||
this.template.getPasteInputObject().pasted(additionalSerialization)
|
||||
.forEach(node => node.entity.exported = true);
|
||||
}
|
||||
continue
|
||||
}
|
||||
const homonym = this.entity.getHomonymObjectEntity(element.entity);
|
||||
|
||||
2
dist/ueblueprint.min.js
vendored
2
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user