mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-21 06:05:45 +08:00
New nodes types added
This commit is contained in:
@@ -150,12 +150,12 @@ export default class NodeTemplate extends ISelectableDraggableTemplate {
|
||||
createPinElements() {
|
||||
return this.element.getPinEntities()
|
||||
.filter(v => !v.isHidden())
|
||||
.map(v => {
|
||||
if (!this.#hasTargetInputNode && v.getDisplayName() === "Target") {
|
||||
.map(pinEntity => {
|
||||
if (!this.#hasTargetInputNode && pinEntity.getDisplayName() == "Target") {
|
||||
this.#hasTargetInputNode = true
|
||||
}
|
||||
let pinElement = /** @type {PinElementConstructor} */(ElementFactory.getConstructor("ueb-pin"))
|
||||
.newObject(v, undefined, this.element)
|
||||
.newObject(pinEntity, undefined, this.element)
|
||||
return pinElement
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,62 +1,18 @@
|
||||
import { html, nothing } from "lit"
|
||||
import ElementFactory from "../../element/ElementFactory"
|
||||
import NodeTemplate from "./NodeTemplate"
|
||||
import Configuration from "../../Configuration"
|
||||
import VariableManagementNodeTemplate from "./VariableMangementNodeTemplate"
|
||||
|
||||
/**
|
||||
* @typedef {import("../../element/NodeElement").default} NodeElement
|
||||
* @typedef {import("../../element/PinElement").default} PinElement
|
||||
* @typedef {import("../../element/PinElement").PinElementConstructor} PinElementConstructor
|
||||
*/
|
||||
/** @typedef {import("../../element/NodeElement").default} NodeElement */
|
||||
|
||||
export default class VariableAccessNodeTemplate extends NodeTemplate {
|
||||
|
||||
#hasInput = false
|
||||
#hasOutput = false
|
||||
#displayName = ""
|
||||
export default class VariableAccessNodeTemplate extends VariableManagementNodeTemplate {
|
||||
|
||||
/** @param {NodeElement} element */
|
||||
initialize(element) {
|
||||
super.initialize(element)
|
||||
this.element.classList.add("ueb-node-style-glass")
|
||||
this.#displayName = this.element.getNodeDisplayName()
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<div class="ueb-node-border">
|
||||
<div class="ueb-node-wrapper">
|
||||
${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}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
` : nothing}
|
||||
<div class="ueb-node-content">
|
||||
${this.#hasInput ? html`
|
||||
<div class="ueb-node-inputs"></div>
|
||||
` : nothing}
|
||||
${this.#hasOutput ? html`
|
||||
<div class="ueb-node-outputs"></div>
|
||||
` : nothing}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
|
||||
createPinElements() {
|
||||
return this.element.getPinEntities()
|
||||
.filter(v => !v.isHidden())
|
||||
.map(v => {
|
||||
this.#hasInput ||= v.isInput()
|
||||
this.#hasOutput ||= v.isOutput()
|
||||
const result = /** @type {PinElementConstructor} */(ElementFactory.getConstructor("ueb-pin"))
|
||||
.newObject(v, undefined, this.element)
|
||||
return result
|
||||
})
|
||||
if (element.getType() === Configuration.nodeType.variableGet) {
|
||||
this.element.classList.add("ueb-node-style-getter")
|
||||
} else if (element.getType() === Configuration.nodeType.variableSet) {
|
||||
this.element.classList.add("ueb-node-style-setter")
|
||||
}
|
||||
}
|
||||
|
||||
setupPins() {
|
||||
|
||||
13
js/template/node/VariableConversionNodeTemplate.js
Normal file
13
js/template/node/VariableConversionNodeTemplate.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import VariableManagementNodeTemplate from "./VariableMangementNodeTemplate"
|
||||
|
||||
/** @typedef {import("../../element/NodeElement").default} NodeElement */
|
||||
|
||||
export default class VariableConversionNodeTemplate extends VariableManagementNodeTemplate {
|
||||
|
||||
|
||||
/** @param {NodeElement} element */
|
||||
initialize(element) {
|
||||
super.initialize(element)
|
||||
this.element.classList.add("ueb-node-style-conversion")
|
||||
}
|
||||
}
|
||||
60
js/template/node/VariableMangementNodeTemplate.js
Normal file
60
js/template/node/VariableMangementNodeTemplate.js
Normal file
@@ -0,0 +1,60 @@
|
||||
import { html, nothing } from "lit"
|
||||
import ElementFactory from "../../element/ElementFactory"
|
||||
import NodeTemplate from "./NodeTemplate"
|
||||
|
||||
/**
|
||||
* @typedef {import("../../element/NodeElement").default} NodeElement
|
||||
* @typedef {import("../../element/PinElement").PinElementConstructor} PinElementConstructor
|
||||
*/
|
||||
|
||||
export default class VariableManagementNodeTemplate extends NodeTemplate {
|
||||
|
||||
#hasInput = false
|
||||
#hasOutput = false
|
||||
#displayName = ""
|
||||
|
||||
/** @param {NodeElement} element */
|
||||
initialize(element) {
|
||||
super.initialize(element)
|
||||
this.element.classList.add("ueb-node-style-glass")
|
||||
this.#displayName = this.element.getNodeDisplayName()
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<div class="ueb-node-border">
|
||||
<div class="ueb-node-wrapper">
|
||||
${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}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
` : nothing}
|
||||
<div class="ueb-node-content">
|
||||
${this.#hasInput ? html`
|
||||
<div class="ueb-node-inputs"></div>
|
||||
` : nothing}
|
||||
${this.#hasOutput ? html`
|
||||
<div class="ueb-node-outputs"></div>
|
||||
` : nothing}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
|
||||
createPinElements() {
|
||||
return this.element.getPinEntities()
|
||||
.filter(v => !v.isHidden())
|
||||
.map(v => {
|
||||
this.#hasInput ||= v.isInput()
|
||||
this.#hasOutput ||= v.isOutput()
|
||||
const result = /** @type {PinElementConstructor} */(ElementFactory.getConstructor("ueb-pin"))
|
||||
.newObject(v, undefined, this.element)
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
13
js/template/node/VariableOperationNodeTemplate.js
Normal file
13
js/template/node/VariableOperationNodeTemplate.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import VariableManagementNodeTemplate from "./VariableMangementNodeTemplate"
|
||||
|
||||
/** @typedef {import("../../element/NodeElement").default} NodeElement */
|
||||
|
||||
export default class VariableOperationNodeTemplate extends VariableManagementNodeTemplate {
|
||||
|
||||
|
||||
/** @param {NodeElement} element */
|
||||
initialize(element) {
|
||||
super.initialize(element)
|
||||
this.element.classList.add("ueb-node-style-operation")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user