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

@@ -56,10 +56,6 @@ export default class BlueprintTemplate extends ITemplate {
/** @type {HTMLElement} */ nodesContainerElement
viewportSize = [0, 0]
#setViewportSize() {
}
/** @param {Blueprint} element */
initialize(element) {
super.initialize(element)

View File

@@ -0,0 +1,6 @@
import NodeTemplate from "./NodeTemplate.js"
export default class MetasoundNodeTemplate extends NodeTemplate {
static nodeStyleClasses = ["ueb-node-style-metasound"]
}

View File

@@ -0,0 +1,5 @@
import VariableManagementNodeTemplate from "./VariableMangementNodeTemplate.js"
export default class MetasoundOperationTemplate extends VariableManagementNodeTemplate {
static nodeStyleClasses = ["ueb-node-style-metasound", "ueb-node-style-operation"]
}

View File

@@ -165,7 +165,7 @@ export default class NodeTemplate extends ISelectableDraggableTemplate {
.filter(v => !v.isHidden())
.map(pinEntity => {
this.#hasSubtitle = this.#hasSubtitle
|| pinEntity.PinName === "self" && pinEntity.pinDisplayName() === "Target"
|| pinEntity.PinName === "self" && pinEntity.pinTitle() === "Target"
return this.createPinElement(pinEntity)
})
}

View File

@@ -6,9 +6,14 @@ export default class VariableAccessNodeTemplate extends VariableManagementNodeTe
/** @param {NodeElement} element */
initialize(element) {
super.initialize(element)
if (element.getType() === Configuration.paths.variableGet) {
const type = element.getType()
if (
type === Configuration.paths.variableGet
|| type === Configuration.paths.self
) {
this.element.classList.add("ueb-node-style-getter")
} else if (element.getType() === Configuration.paths.variableSet) {
this.displayName = ""
} else if (type === Configuration.paths.variableSet) {
this.element.classList.add("ueb-node-style-setter")
}
}

View File

@@ -7,25 +7,25 @@ export default class VariableManagementNodeTemplate extends NodeTemplate {
#hasInput = false
#hasOutput = false
#displayName = ""
displayName = ""
static nodeStyleClasses = ["ueb-node-style-glass"]
/** @param {NodeElement} element */
initialize(element) {
super.initialize(element)
this.#displayName = this.element.nodeDisplayName
this.displayName = this.element.nodeDisplayName
}
render() {
return html`
<div class="ueb-node-border">
<div class="ueb-node-wrapper">
${this.#displayName ? html`
${this.displayName ? html`
<div class="ueb-node-top">
<div class="ueb-node-name">
<span class="ueb-node-name-text ueb-ellipsis-nowrap-text">
${this.#displayName}
${this.displayName}
</span>
</div>
</div>

View File

@@ -0,0 +1,5 @@
import MinimalPinTemplate from "./MinimalPinTemplate.js"
export default class InternalPinTemplate extends MinimalPinTemplate {
}

View File

@@ -4,6 +4,7 @@ import SVGIcon from "../../SVGIcon.js"
import Utility from "../../Utility.js"
import MouseCreateLink from "../../input/mouse/MouseCreateLink.js"
import ITemplate from "../ITemplate.js"
import MetasoundOperationTemplate from "../node/MetasoundOperationTemplate.js"
import VariableConversionNodeTemplate from "../node/VariableConversionNodeTemplate.js"
import VariableOperationNodeTemplate from "../node/VariableOperationNodeTemplate.js"
@@ -42,6 +43,7 @@ export default class PinTemplate extends ITemplate {
this.isNameRendered = !(
nodeTemplate instanceof VariableConversionNodeTemplate
|| nodeTemplate instanceof VariableOperationNodeTemplate
|| nodeTemplate instanceof MetasoundOperationTemplate
)
}
}

View File

@@ -6,7 +6,7 @@ import INumericPinTemplate from "./INumericPinTemplate.js"
/**
* @extends INumericPinTemplate<Vector2DEntity>
*/
export default class VectorInputPinTemplate extends INumericPinTemplate {
export default class Vector2DPinTemplate extends INumericPinTemplate {
#getX() {
return Utility.printNumber(this.element.getDefaultValue()?.X ?? 0)

View File

@@ -0,0 +1,63 @@
import { html } from "lit"
import Utility from "../../Utility.js"
import INumericPinTemplate from "./INumericPinTemplate.js"
import Vector4DEntity from "../../entity/Vector4DEntity.js"
/** @extends INumericPinTemplate<Vector4DEntity> */
export default class Vector4DPinTemplate extends INumericPinTemplate {
#getX() {
return Utility.printNumber(this.element.getDefaultValue()?.X ?? 0)
}
#getY() {
return Utility.printNumber(this.element.getDefaultValue()?.Y ?? 0)
}
#getZ() {
return Utility.printNumber(this.element.getDefaultValue()?.Z ?? 0)
}
#getW() {
return Utility.printNumber(this.element.getDefaultValue()?.W ?? 0)
}
/**
* @param {Number[]} values
* @param {String[]} rawValues
*/
setDefaultValue(values, rawValues) {
const vector = this.element.getDefaultValue(true)
if (!(vector instanceof Vector4DEntity)) {
throw new TypeError("Expected DefaultValue to be a Vector4DEntity")
}
vector.X = values[0]
vector.Y = values[1]
vector.Z = values[2]
vector.W = values[3]
this.element.requestUpdate("DefaultValue", vector)
}
renderInput() {
return html`
<div class="ueb-pin-input-wrapper">
<span class="ueb-pin-input-label">X</span>
<div class="ueb-pin-input">
<ueb-input .singleLine="${true}" .innerText="${this.#getX()}"></ueb-input>
</div>
<span class="ueb-pin-input-label">Y</span>
<div class="ueb-pin-input">
<ueb-input .singleLine="${true}" .innerText="${this.#getY()}"></ueb-input>
</div>
<span class="ueb-pin-input-label">Z</span>
<div class="ueb-pin-input">
<ueb-input .singleLine="${true}" .innerText="${this.#getZ()}"></ueb-input>
</div>
<span class="ueb-pin-input-label">W</span>
<div class="ueb-pin-input">
<ueb-input .singleLine="${true}" .innerText="${this.#getW()}"></ueb-input>
</div>
</div>
`
}
}