Niagara and Metasound nodes WIP

* Keep track of entities

* Fix renaming

* Niagara variables wip

* Several niagara decode and test

* Move nodeTemplate code to dedicated file, self node added

* Move node decoding functions to dedicated files

* Move pin decoding logic to dedicated files

* Accept space separated keys in objects

* Build

* Prevent a crash in case of incomplete object

* Avoid creating objects unnecessarily

* types formatting

* Initial metasound style

* Common pcg nodes colors

* Fix string serialization

* Metasound new styles and fixes

* More metasound styles and colors

* WIP

* Several fixes

* More tests and fixes

* Clean gitignore
This commit is contained in:
barsdeveloper
2024-05-20 12:56:36 +02:00
committed by GitHub
parent 08e2e8edd8
commit a5813d0b4d
72 changed files with 6903 additions and 4879 deletions

View File

@@ -295,8 +295,9 @@ export default class Utility {
* @template T
* @param {Array<T>} a
* @param {Array<T>} b
* @param {(l: T, r: T) => Boolean} predicate
*/
static mergeArrays(a = [], b = []) {
static mergeArrays(a = [], b = [], predicate = (l, r) => l == r) {
let result = []
a = [...a]
b = [...b]
@@ -304,7 +305,7 @@ export default class Utility {
while (true) {
for (let j = 0; j < b.length; ++j) {
for (let i = 0; i < a.length; ++i) {
if (a[i] == b[j]) {
if (predicate(a[i], b[j])) {
// Found an element in common in the two arrays
result.push(
// Take and append all the elements skipped from a
@@ -325,6 +326,13 @@ export default class Utility {
return [...(new Set(result.concat(...a, ...b)))]
}
/** @param {String} value */
static escapeNewlines(value) {
return value
.replaceAll("\n", "\\n") // Replace newline with \n
.replaceAll("\t", "\\t") // Replace tab with \t
}
/** @param {String} value */
static escapeString(value) {
return value
@@ -384,8 +392,10 @@ export default class Utility {
}
/** @param {String} pathValue */
static getNameFromPath(pathValue) {
return pathValue.match(/[^\.\/]+$/)?.[0] ?? ""
static getNameFromPath(pathValue, dropCounter = false) {
// From end to the first "/" or "."
const regex = dropCounter ? /([^\.\/]+?)(?:_\d+)$/ : /([^\.\/]+)$/
return pathValue.match(regex)?.[1] ?? ""
}
/** @param {LinearColorEntity} value */