mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-04-14 10:47:34 +08:00
Sound cue nodes and bottom graph type right text
This commit is contained in:
@@ -56,6 +56,7 @@ Configuration:
|
||||
- Height: `<ueb-blueprint style="--ueb-height: 500px">`
|
||||
- Light mode: `<ueb-blueprint class="ueb-light-mode">`
|
||||
- Initial zoom: `<ueb-blueprint data-zoom="-4">`
|
||||
- Graph type: `<ueb-blueprint data-type="MATERIAL FUNCTION">`
|
||||
```HTML
|
||||
<ueb-blueprint>
|
||||
<template>
|
||||
|
||||
12
dist/css/ueb-style.css
vendored
12
dist/css/ueb-style.css
vendored
@@ -68,6 +68,18 @@ ueb-blueprint svg {
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
.ueb-viewport-type {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 5px;
|
||||
font-size: 60px;
|
||||
font-weight: 900;
|
||||
color: rgba(128, 128, 128, 0.2509803922);
|
||||
font-stretch: condensed;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.ueb-viewport-body {
|
||||
position: relative;
|
||||
height: var(--ueb-height, 30rem);
|
||||
|
||||
2
dist/css/ueb-style.css.map
vendored
2
dist/css/ueb-style.css.map
vendored
File diff suppressed because one or more lines are too long
2
dist/css/ueb-style.min.css
vendored
2
dist/css/ueb-style.min.css
vendored
File diff suppressed because one or more lines are too long
2
dist/css/ueb-style.min.css.map
vendored
2
dist/css/ueb-style.min.css.map
vendored
File diff suppressed because one or more lines are too long
78
dist/ueblueprint.js
vendored
78
dist/ueblueprint.js
vendored
@@ -230,6 +230,8 @@ class Configuration {
|
||||
select: "/Script/BlueprintGraph.K2Node_Select",
|
||||
self: "/Script/BlueprintGraph.K2Node_Self",
|
||||
slateBlueprintLibrary: "/Script/UMG.SlateBlueprintLibrary",
|
||||
soundCueGraphNode: "/Script/AudioEditor.SoundCueGraphNode",
|
||||
soundNodeWavePlayer: "/Script/Engine.SoundNodeWavePlayer",
|
||||
spawnActorFromClass: "/Script/BlueprintGraph.K2Node_SpawnActorFromClass",
|
||||
switchEnum: "/Script/BlueprintGraph.K2Node_SwitchEnum",
|
||||
switchGameplayTag: "/Script/GameplayTagsEditor.GameplayTagsK2Node_SwitchGameplayTag",
|
||||
@@ -4273,6 +4275,13 @@ function nodeTitle(entity) {
|
||||
return "Input"
|
||||
case p$6.pcgEditorGraphNodeOutput:
|
||||
return "Output"
|
||||
case p$6.soundNodeWavePlayer:
|
||||
return `Wave Player : ${entity.getSounCueSubobject()
|
||||
?.SoundWaveAssetPtr
|
||||
?.type
|
||||
.match(/([^.]+)$/)
|
||||
?.[0]
|
||||
?? "NONE"}`
|
||||
case p$6.spawnActorFromClass:
|
||||
let className = entity.getCustomproperties()
|
||||
.find(pinEntity => pinEntity.PinName.toString() == "ReturnValue")
|
||||
@@ -4328,6 +4337,10 @@ function nodeTitle(entity) {
|
||||
let result = pcgSubobject.NodeTitle ? pcgSubobject.NodeTitle.toString() : nodeTitle(pcgSubobject);
|
||||
return result
|
||||
}
|
||||
const soundCueSubobject = entity.getSounCueSubobject();
|
||||
if (soundCueSubobject) {
|
||||
return Utility.formatStringName(soundCueSubobject.getObjectName(true).replace(/^SoundNode/, ""))
|
||||
}
|
||||
const subgraphObject = entity.getSubgraphObject();
|
||||
if (subgraphObject) {
|
||||
return subgraphObject.Graph.getName()
|
||||
@@ -4520,7 +4533,7 @@ const p$5 = Configuration.paths;
|
||||
|
||||
/** @param {ObjectEntity} entity */
|
||||
function nodeIcon(entity) {
|
||||
if (entity.isMaterial() || entity.isPcg() || entity.isNiagara()) {
|
||||
if (entity.isMaterial() || entity.isPcg() || entity.isSoundCue() || entity.isNiagara()) {
|
||||
return null
|
||||
}
|
||||
switch (entity.getType()) {
|
||||
@@ -6409,6 +6422,8 @@ class ObjectEntity extends IEntity {
|
||||
PositionY: MirroredEntity.of(IntegerEntity),
|
||||
SettingsInterface: ObjectReferenceEntity,
|
||||
PCGNode: ObjectReferenceEntity,
|
||||
SoundNode: ObjectReferenceEntity,
|
||||
SoundWaveAssetPtr: ObjectReferenceEntity,
|
||||
HiGenGridSize: SymbolEntity,
|
||||
Operation: SymbolEntity,
|
||||
NodePosX: IntegerEntity,
|
||||
@@ -6553,6 +6568,8 @@ class ObjectEntity extends IEntity {
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.OutputPins>} */ this.OutputPins;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.ParameterName>} */ this.ParameterName;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PCGNode>} */ this.PCGNode;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.SoundNode>} */ this.SoundNode;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.SoundWaveAssetPtr>} */ this.SoundWaveAssetPtr;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PinNames>} */ this.PinNames;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PinTags>} */ this.PinTags;
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PositionX>} */ this.PositionX;
|
||||
@@ -6768,6 +6785,10 @@ class ObjectEntity extends IEntity {
|
||||
if (this.MaterialExpression) {
|
||||
return this.MaterialExpression.type
|
||||
}
|
||||
let subobject = this.getSounCueSubobject();
|
||||
if (subobject) {
|
||||
return subobject.getClass()
|
||||
}
|
||||
return this.getClass()
|
||||
}
|
||||
|
||||
@@ -6901,14 +6922,33 @@ class ObjectEntity extends IEntity {
|
||||
}
|
||||
|
||||
isPcg() {
|
||||
return this.getClass() === Configuration.paths.pcgEditorGraphNode
|
||||
|| this.getPcgSubobject() != null
|
||||
return this.getClass() == Configuration.paths.pcgEditorGraphNode || this.getPcgSubobject() != null
|
||||
}
|
||||
|
||||
isNiagara() {
|
||||
return this.Class && (this.Class.type ? this.Class.type : this.Class.path)?.startsWith("/Script/NiagaraEditor.")
|
||||
}
|
||||
|
||||
isSoundCue() {
|
||||
return this.getClass() == Configuration.paths.soundCueGraphNode
|
||||
}
|
||||
|
||||
getBlueprintType() {
|
||||
if (this.isMaterial()) {
|
||||
return "MATERIAL"
|
||||
}
|
||||
if (this.isNiagara()) {
|
||||
return "NIAGARA"
|
||||
}
|
||||
if (this.isPcg()) {
|
||||
return "PCG Graph"
|
||||
}
|
||||
if (this.isSoundCue()) {
|
||||
return "SOUND CUE"
|
||||
}
|
||||
return "BLUEPRINT"
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
getPcgSubobject() {
|
||||
const node = this.PCGNode;
|
||||
@@ -6917,6 +6957,14 @@ class ObjectEntity extends IEntity {
|
||||
: null
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
getSounCueSubobject() {
|
||||
const node = this.SoundNode;
|
||||
return node
|
||||
? this[Configuration.subObjectAttributeNameFromReference(node, true)]
|
||||
: null
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
getSettingsObject() {
|
||||
const settings = this.SettingsInterface;
|
||||
@@ -11259,7 +11307,7 @@ class BlueprintTemplate extends ITemplate {
|
||||
Zoom ${this.blueprint.zoom == 0 ? "1:1" : (this.blueprint.zoom > 0 ? "+" : "") + this.blueprint.zoom}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ueb-viewport-overlay"></div>
|
||||
<div class="ueb-viewport-type">${this.blueprint.blueprintType}</div>
|
||||
<div class="ueb-viewport-body">
|
||||
<div class="ueb-grid"
|
||||
style="--ueb-additional-x: ${Math.round(this.blueprint.translateX)}; --ueb-additional-y: ${Math.round(this.blueprint.translateY)}; --ueb-translate-x: ${Math.round(this.blueprint.translateX)}; --ueb-translate-y: ${Math.round(this.blueprint.translateY)};">
|
||||
@@ -11432,6 +11480,11 @@ class BlueprintTemplate extends ITemplate {
|
||||
class Blueprint extends IElement {
|
||||
|
||||
static properties = {
|
||||
blueprintType: {
|
||||
type: String,
|
||||
attribute: "data-type",
|
||||
reflect: true,
|
||||
},
|
||||
selecting: {
|
||||
type: Boolean,
|
||||
attribute: "data-selecting",
|
||||
@@ -11508,6 +11561,7 @@ class Blueprint extends IElement {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.blueprintType = "";
|
||||
this.selecting = false;
|
||||
this.scrolling = false;
|
||||
this.focused = false;
|
||||
@@ -11808,17 +11862,17 @@ class Blueprint extends IElement {
|
||||
const removeEventHandler = event => {
|
||||
const target = event.currentTarget;
|
||||
target.removeEventListener(Configuration.removeEventName, removeEventHandler);
|
||||
const [graphElementsArray, entity] = target instanceof NodeElement
|
||||
const [container, entity] = target instanceof NodeElement
|
||||
? [this.nodes, target.entity]
|
||||
: target instanceof LinkElement
|
||||
? [this.links]
|
||||
: null;
|
||||
// @ts-expect-error
|
||||
const index = graphElementsArray?.indexOf(target);
|
||||
const index = container?.indexOf(target);
|
||||
if (index >= 0) {
|
||||
const last = graphElementsArray.pop();
|
||||
if (index < graphElementsArray.length) {
|
||||
graphElementsArray[index] = last;
|
||||
const last = container.pop();
|
||||
if (index < container.length) {
|
||||
container[index] = last;
|
||||
}
|
||||
}
|
||||
if (entity) {
|
||||
@@ -11849,6 +11903,9 @@ class Blueprint extends IElement {
|
||||
this.entity.addObjectEntity(element.entity);
|
||||
element.addEventListener(Configuration.removeEventName, removeEventHandler);
|
||||
this.template.nodesContainerElement?.appendChild(element);
|
||||
if (!this.blueprintType) {
|
||||
this.blueprintType = element.entity.getBlueprintType();
|
||||
}
|
||||
} else if (element instanceof LinkElement && !this.links.includes(element)) {
|
||||
this.links.push(element);
|
||||
element.addEventListener(Configuration.removeEventName, removeEventHandler);
|
||||
@@ -11875,6 +11932,9 @@ class Blueprint extends IElement {
|
||||
}
|
||||
element.remove();
|
||||
}
|
||||
if (this.nodes.length == 0) {
|
||||
this.blueprintType = "";
|
||||
}
|
||||
}
|
||||
|
||||
setFocused(value = true) {
|
||||
|
||||
8
dist/ueblueprint.min.js
vendored
8
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -12,6 +12,11 @@ import BlueprintTemplate from "./template/BlueprintTemplate.js"
|
||||
export default class Blueprint extends IElement {
|
||||
|
||||
static properties = {
|
||||
blueprintType: {
|
||||
type: String,
|
||||
attribute: "data-type",
|
||||
reflect: true,
|
||||
},
|
||||
selecting: {
|
||||
type: Boolean,
|
||||
attribute: "data-selecting",
|
||||
@@ -88,6 +93,7 @@ export default class Blueprint extends IElement {
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
this.blueprintType = ""
|
||||
this.selecting = false
|
||||
this.scrolling = false
|
||||
this.focused = false
|
||||
@@ -388,17 +394,17 @@ export default class Blueprint extends IElement {
|
||||
const removeEventHandler = event => {
|
||||
const target = event.currentTarget
|
||||
target.removeEventListener(Configuration.removeEventName, removeEventHandler)
|
||||
const [graphElementsArray, entity] = target instanceof NodeElement
|
||||
const [container, entity] = target instanceof NodeElement
|
||||
? [this.nodes, target.entity]
|
||||
: target instanceof LinkElement
|
||||
? [this.links]
|
||||
: null
|
||||
// @ts-expect-error
|
||||
const index = graphElementsArray?.indexOf(target)
|
||||
const index = container?.indexOf(target)
|
||||
if (index >= 0) {
|
||||
const last = graphElementsArray.pop()
|
||||
if (index < graphElementsArray.length) {
|
||||
graphElementsArray[index] = last
|
||||
const last = container.pop()
|
||||
if (index < container.length) {
|
||||
container[index] = last
|
||||
}
|
||||
}
|
||||
if (entity) {
|
||||
@@ -429,6 +435,9 @@ export default class Blueprint extends IElement {
|
||||
this.entity.addObjectEntity(element.entity)
|
||||
element.addEventListener(Configuration.removeEventName, removeEventHandler)
|
||||
this.template.nodesContainerElement?.appendChild(element)
|
||||
if (!this.blueprintType) {
|
||||
this.blueprintType = element.entity.getBlueprintType()
|
||||
}
|
||||
} else if (element instanceof LinkElement && !this.links.includes(element)) {
|
||||
this.links.push(element)
|
||||
element.addEventListener(Configuration.removeEventName, removeEventHandler)
|
||||
@@ -455,6 +464,9 @@ export default class Blueprint extends IElement {
|
||||
}
|
||||
element.remove()
|
||||
}
|
||||
if (this.nodes.length == 0) {
|
||||
this.blueprintType = ""
|
||||
}
|
||||
}
|
||||
|
||||
setFocused(value = true) {
|
||||
|
||||
@@ -206,6 +206,8 @@ export default class Configuration {
|
||||
select: "/Script/BlueprintGraph.K2Node_Select",
|
||||
self: "/Script/BlueprintGraph.K2Node_Self",
|
||||
slateBlueprintLibrary: "/Script/UMG.SlateBlueprintLibrary",
|
||||
soundCueGraphNode: "/Script/AudioEditor.SoundCueGraphNode",
|
||||
soundNodeWavePlayer: "/Script/Engine.SoundNodeWavePlayer",
|
||||
spawnActorFromClass: "/Script/BlueprintGraph.K2Node_SpawnActorFromClass",
|
||||
switchEnum: "/Script/BlueprintGraph.K2Node_SwitchEnum",
|
||||
switchGameplayTag: "/Script/GameplayTagsEditor.GameplayTagsK2Node_SwitchGameplayTag",
|
||||
|
||||
@@ -6,7 +6,7 @@ const p = Configuration.paths
|
||||
|
||||
/** @param {ObjectEntity} entity */
|
||||
export default function nodeIcon(entity) {
|
||||
if (entity.isMaterial() || entity.isPcg() || entity.isNiagara()) {
|
||||
if (entity.isMaterial() || entity.isPcg() || entity.isSoundCue() || entity.isNiagara()) {
|
||||
return null
|
||||
}
|
||||
switch (entity.getType()) {
|
||||
|
||||
@@ -268,6 +268,13 @@ export default function nodeTitle(entity) {
|
||||
return "Input"
|
||||
case p.pcgEditorGraphNodeOutput:
|
||||
return "Output"
|
||||
case p.soundNodeWavePlayer:
|
||||
return `Wave Player : ${entity.getSounCueSubobject()
|
||||
?.SoundWaveAssetPtr
|
||||
?.type
|
||||
.match(/([^.]+)$/)
|
||||
?.[0]
|
||||
?? "NONE"}`
|
||||
case p.spawnActorFromClass:
|
||||
let className = entity.getCustomproperties()
|
||||
.find(pinEntity => pinEntity.PinName.toString() == "ReturnValue")
|
||||
@@ -323,6 +330,10 @@ export default function nodeTitle(entity) {
|
||||
let result = pcgSubobject.NodeTitle ? pcgSubobject.NodeTitle.toString() : nodeTitle(pcgSubobject)
|
||||
return result
|
||||
}
|
||||
const soundCueSubobject = entity.getSounCueSubobject()
|
||||
if (soundCueSubobject) {
|
||||
return Utility.formatStringName(soundCueSubobject.getObjectName(true).replace(/^SoundNode/, ""))
|
||||
}
|
||||
const subgraphObject = entity.getSubgraphObject()
|
||||
if (subgraphObject) {
|
||||
return subgraphObject.Graph.getName()
|
||||
|
||||
@@ -119,6 +119,8 @@ export default class ObjectEntity extends IEntity {
|
||||
PositionY: MirroredEntity.of(IntegerEntity),
|
||||
SettingsInterface: ObjectReferenceEntity,
|
||||
PCGNode: ObjectReferenceEntity,
|
||||
SoundNode: ObjectReferenceEntity,
|
||||
SoundWaveAssetPtr: ObjectReferenceEntity,
|
||||
HiGenGridSize: SymbolEntity,
|
||||
Operation: SymbolEntity,
|
||||
NodePosX: IntegerEntity,
|
||||
@@ -263,6 +265,8 @@ export default class ObjectEntity extends IEntity {
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.OutputPins>} */ this.OutputPins
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.ParameterName>} */ this.ParameterName
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PCGNode>} */ this.PCGNode
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.SoundNode>} */ this.SoundNode
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.SoundWaveAssetPtr>} */ this.SoundWaveAssetPtr
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PinNames>} */ this.PinNames
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PinTags>} */ this.PinTags
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PositionX>} */ this.PositionX
|
||||
@@ -478,6 +482,10 @@ export default class ObjectEntity extends IEntity {
|
||||
if (this.MaterialExpression) {
|
||||
return this.MaterialExpression.type
|
||||
}
|
||||
let subobject = this.getSounCueSubobject()
|
||||
if (subobject) {
|
||||
return subobject.getClass()
|
||||
}
|
||||
return this.getClass()
|
||||
}
|
||||
|
||||
@@ -613,14 +621,33 @@ export default class ObjectEntity extends IEntity {
|
||||
}
|
||||
|
||||
isPcg() {
|
||||
return this.getClass() === Configuration.paths.pcgEditorGraphNode
|
||||
|| this.getPcgSubobject() != null
|
||||
return this.getClass() == Configuration.paths.pcgEditorGraphNode || this.getPcgSubobject() != null
|
||||
}
|
||||
|
||||
isNiagara() {
|
||||
return this.Class && (this.Class.type ? this.Class.type : this.Class.path)?.startsWith("/Script/NiagaraEditor.")
|
||||
}
|
||||
|
||||
isSoundCue() {
|
||||
return this.getClass() == Configuration.paths.soundCueGraphNode
|
||||
}
|
||||
|
||||
getBlueprintType() {
|
||||
if (this.isMaterial()) {
|
||||
return "MATERIAL"
|
||||
}
|
||||
if (this.isNiagara()) {
|
||||
return "NIAGARA"
|
||||
}
|
||||
if (this.isPcg()) {
|
||||
return "PCG Graph"
|
||||
}
|
||||
if (this.isSoundCue()) {
|
||||
return "SOUND CUE"
|
||||
}
|
||||
return "BLUEPRINT"
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
getPcgSubobject() {
|
||||
const node = this.PCGNode
|
||||
@@ -629,6 +656,14 @@ export default class ObjectEntity extends IEntity {
|
||||
: null
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
getSounCueSubobject() {
|
||||
const node = this.SoundNode
|
||||
return node
|
||||
? this[Configuration.subObjectAttributeNameFromReference(node, true)]
|
||||
: null
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
getSettingsObject() {
|
||||
const settings = this.SettingsInterface
|
||||
|
||||
@@ -146,7 +146,7 @@ export default class BlueprintTemplate extends ITemplate {
|
||||
Zoom ${this.blueprint.zoom == 0 ? "1:1" : (this.blueprint.zoom > 0 ? "+" : "") + this.blueprint.zoom}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ueb-viewport-overlay"></div>
|
||||
<div class="ueb-viewport-type">${this.blueprint.blueprintType}</div>
|
||||
<div class="ueb-viewport-body">
|
||||
<div class="ueb-grid"
|
||||
style="--ueb-additional-x: ${Math.round(this.blueprint.translateX)}; --ueb-additional-y: ${Math.round(this.blueprint.translateY)}; --ueb-translate-x: ${Math.round(this.blueprint.translateX)}; --ueb-translate-y: ${Math.round(this.blueprint.translateY)};">
|
||||
|
||||
@@ -72,6 +72,18 @@ ueb-blueprint svg {
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
.ueb-viewport-type {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 5px;
|
||||
font-size: 60px;
|
||||
font-weight: 900;
|
||||
color: #80808040;
|
||||
font-stretch: condensed;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.ueb-viewport-body {
|
||||
position: relative;
|
||||
height: var(--ueb-height, 30rem);
|
||||
|
||||
Reference in New Issue
Block a user