mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-20 04:47:35 +08:00
Fix attributes keys order
This commit is contained in:
21
dist/ueblueprint.js
vendored
21
dist/ueblueprint.js
vendored
@@ -819,6 +819,7 @@ class Utility {
|
|||||||
*/
|
*/
|
||||||
static mergeArrays(a = [], b = []) {
|
static mergeArrays(a = [], b = []) {
|
||||||
let result = [];
|
let result = [];
|
||||||
|
restart:
|
||||||
for (let j = 0; j < b.length; ++j) {
|
for (let j = 0; j < b.length; ++j) {
|
||||||
for (let i = 0; i < a.length; ++i) {
|
for (let i = 0; i < a.length; ++i) {
|
||||||
if (a[i] == b[j]) {
|
if (a[i] == b[j]) {
|
||||||
@@ -831,10 +832,8 @@ class Utility {
|
|||||||
// Take and append the element in common
|
// Take and append the element in common
|
||||||
...a.splice(0, 1)
|
...a.splice(0, 1)
|
||||||
);
|
);
|
||||||
j = 0;
|
|
||||||
i = 0;
|
|
||||||
b.shift();
|
b.shift();
|
||||||
break
|
break restart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2308,8 +2307,8 @@ class Grammar {
|
|||||||
r.LocalizedText,
|
r.LocalizedText,
|
||||||
r.InvariantText,
|
r.InvariantText,
|
||||||
r.PinReference,
|
r.PinReference,
|
||||||
Grammar.createEntityGrammar(r, Vector2DEntity, true),
|
|
||||||
Grammar.createEntityGrammar(r, VectorEntity, true),
|
Grammar.createEntityGrammar(r, VectorEntity, true),
|
||||||
|
Grammar.createEntityGrammar(r, Vector2DEntity, true),
|
||||||
Grammar.createEntityGrammar(r, LinearColorEntity, true),
|
Grammar.createEntityGrammar(r, LinearColorEntity, true),
|
||||||
r.UnknownKeys,
|
r.UnknownKeys,
|
||||||
r.ObjectReference,
|
r.ObjectReference,
|
||||||
@@ -2608,7 +2607,15 @@ class ISerializer {
|
|||||||
let result = "";
|
let result = "";
|
||||||
let fullKey = key.concat("");
|
let fullKey = key.concat("");
|
||||||
const last = fullKey.length - 1;
|
const last = fullKey.length - 1;
|
||||||
for (const property of Object.getOwnPropertyNames(object)) {
|
const attributes = /** @type {EntityConstructor} */(object.constructor).attributes;
|
||||||
|
const keys =
|
||||||
|
attributes ?
|
||||||
|
Utility.mergeArrays(
|
||||||
|
Object.getOwnPropertyNames(attributes),
|
||||||
|
Object.getOwnPropertyNames(object)
|
||||||
|
)
|
||||||
|
: Object.getOwnPropertyNames(object);
|
||||||
|
for (const property of keys) {
|
||||||
fullKey[last] = property;
|
fullKey[last] = property;
|
||||||
const value = object[property];
|
const value = object[property];
|
||||||
if (value?.constructor === Object) {
|
if (value?.constructor === Object) {
|
||||||
@@ -7202,10 +7209,8 @@ class ExecPinTemplate extends PinTemplate {
|
|||||||
class IntInputPinTemplate extends INumericPinTemplate {
|
class IntInputPinTemplate extends INumericPinTemplate {
|
||||||
|
|
||||||
setDefaultValue(values = [], rawValues = values) {
|
setDefaultValue(values = [], rawValues = values) {
|
||||||
|
parseInt(values[0]);
|
||||||
const integer = this.element.getDefaultValue(true);
|
const integer = this.element.getDefaultValue(true);
|
||||||
if (!(integer instanceof IntegerEntity)) {
|
|
||||||
throw new TypeError("Expected DefaultValue to be a IntegerEntity")
|
|
||||||
}
|
|
||||||
integer.value = values[0];
|
integer.value = values[0];
|
||||||
this.element.requestUpdate("DefaultValue", integer);
|
this.element.requestUpdate("DefaultValue", integer);
|
||||||
}
|
}
|
||||||
|
|||||||
2
dist/ueblueprint.min.js
vendored
2
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -211,10 +211,13 @@ export default class Utility {
|
|||||||
*/
|
*/
|
||||||
static mergeArrays(a = [], b = []) {
|
static mergeArrays(a = [], b = []) {
|
||||||
let result = []
|
let result = []
|
||||||
|
a = [...a]
|
||||||
|
b = [...b]
|
||||||
|
restart:
|
||||||
for (let j = 0; j < b.length; ++j) {
|
for (let j = 0; j < b.length; ++j) {
|
||||||
for (let i = 0; i < a.length; ++i) {
|
for (let i = 0; i < a.length; ++i) {
|
||||||
if (a[i] == b[j]) {
|
if (a[i] == b[j]) {
|
||||||
// Found a corresponding element in the two arrays
|
// Found an element in common in the two arrays
|
||||||
result.push(
|
result.push(
|
||||||
// Take and append all the elements skipped from a
|
// Take and append all the elements skipped from a
|
||||||
...a.splice(0, i),
|
...a.splice(0, i),
|
||||||
@@ -223,10 +226,8 @@ export default class Utility {
|
|||||||
// Take and append the element in common
|
// Take and append the element in common
|
||||||
...a.splice(0, 1)
|
...a.splice(0, 1)
|
||||||
)
|
)
|
||||||
j = 0
|
b.shift() // Remove the same element from b
|
||||||
i = 0
|
break restart
|
||||||
b.shift()
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -324,9 +324,9 @@ export default class Grammar {
|
|||||||
r.LocalizedText,
|
r.LocalizedText,
|
||||||
r.InvariantText,
|
r.InvariantText,
|
||||||
r.PinReference,
|
r.PinReference,
|
||||||
Grammar.createEntityGrammar(r, Vector2DEntity, true),
|
|
||||||
Grammar.createEntityGrammar(r, VectorEntity, true),
|
Grammar.createEntityGrammar(r, VectorEntity, true),
|
||||||
Grammar.createEntityGrammar(r, LinearColorEntity, true),
|
Grammar.createEntityGrammar(r, LinearColorEntity, true),
|
||||||
|
Grammar.createEntityGrammar(r, Vector2DEntity, true),
|
||||||
r.UnknownKeys,
|
r.UnknownKeys,
|
||||||
r.ObjectReference,
|
r.ObjectReference,
|
||||||
r.Symbol,
|
r.Symbol,
|
||||||
|
|||||||
@@ -89,7 +89,15 @@ export default class ISerializer {
|
|||||||
let result = ""
|
let result = ""
|
||||||
let fullKey = key.concat("")
|
let fullKey = key.concat("")
|
||||||
const last = fullKey.length - 1
|
const last = fullKey.length - 1
|
||||||
for (const property of Object.getOwnPropertyNames(object)) {
|
const attributes = /** @type {EntityConstructor} */(object.constructor).attributes
|
||||||
|
const keys =
|
||||||
|
attributes ?
|
||||||
|
Utility.mergeArrays(
|
||||||
|
Object.getOwnPropertyNames(attributes),
|
||||||
|
Object.getOwnPropertyNames(object)
|
||||||
|
)
|
||||||
|
: Object.getOwnPropertyNames(object)
|
||||||
|
for (const property of keys) {
|
||||||
fullKey[last] = property
|
fullKey[last] = property
|
||||||
const value = object[property]
|
const value = object[property]
|
||||||
if (value?.constructor === Object) {
|
if (value?.constructor === Object) {
|
||||||
|
|||||||
Reference in New Issue
Block a user