mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:41:34 +08:00
PCG nodes and other fixes (#14)
* Various fixes * Fix name from SettingsInterface * Allow path lookbehind for unknown keys entity * Subraph object name * Several fixes * Various fixes * Fix colors * Various pin types
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { css, html } from "lit"
|
||||
import { html } from "lit"
|
||||
import Configuration from "../../Configuration.js"
|
||||
import IResizeableTemplate from "../IResizeableTemplate.js"
|
||||
import LinearColorEntity from "../../entity/LinearColorEntity.js"
|
||||
import Utility from "../../Utility.js"
|
||||
|
||||
/**
|
||||
@@ -11,30 +10,17 @@ import Utility from "../../Utility.js"
|
||||
|
||||
export default class CommentNodeTemplate extends IResizeableTemplate {
|
||||
|
||||
#color = LinearColorEntity.getWhite()
|
||||
#selectableAreaHeight = 0
|
||||
|
||||
/** @param {NodeElement} element */
|
||||
initialize(element) {
|
||||
super.initialize(element)
|
||||
if (element.entity.CommentColor) {
|
||||
this.#color.setFromRGBANumber(element.entity.CommentColor.toNumber())
|
||||
this.#color.setFromHSVA(
|
||||
this.#color.H.value,
|
||||
this.#color.S.value,
|
||||
Math.pow(this.#color.V.value, 0.45) * 0.67
|
||||
)
|
||||
}
|
||||
element.classList.add("ueb-node-style-comment", "ueb-node-resizeable")
|
||||
element.sizeX = 25 * Configuration.gridSize
|
||||
element.sizeY = 6 * Configuration.gridSize
|
||||
super.initialize(element) // Keep it at the end because it calls this.getColor() where this.#color must be initialized
|
||||
}
|
||||
|
||||
getColor() {
|
||||
return css`${Math.round(this.#color.R.value * 255)}, ${Math.round(this.#color.G.value * 255)}, ${Math.round(this.#color.B.value * 255)}`
|
||||
}
|
||||
|
||||
getDraggableElement() {
|
||||
return this.element.querySelector(".ueb-node-top")
|
||||
}
|
||||
|
||||
@@ -89,6 +89,29 @@ export default class PinTemplate extends ITemplate {
|
||||
}
|
||||
|
||||
renderIcon() {
|
||||
if (this.element.nodeElement.entity.isPcg()) {
|
||||
switch (this.element.entity.getType()) {
|
||||
case "Any":
|
||||
return SVGIcon.pcgPin
|
||||
case "Param":
|
||||
case "Param[]":
|
||||
return SVGIcon.pcgPinParam
|
||||
case "Spatial":
|
||||
case "Spatial[]":
|
||||
return SVGIcon.pcgSpatialPin
|
||||
case "Any[]":
|
||||
case "Point[]":
|
||||
case "Surface[]":
|
||||
case "Volume[]":
|
||||
if (this.element.isOutput()) {
|
||||
return SVGIcon.pcgPin
|
||||
}
|
||||
case "Point":
|
||||
case "Surface":
|
||||
case "Volume":
|
||||
return SVGIcon.pcgPinStack
|
||||
}
|
||||
}
|
||||
switch (this.element.entity.PinType.ContainerType?.toString()) {
|
||||
case "Array": return SVGIcon.array
|
||||
case "Set": return SVGIcon.set
|
||||
|
||||
Reference in New Issue
Block a user