mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:41:34 +08:00
Sound cue nodes and bottom graph type right text
This commit is contained in:
@@ -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)};">
|
||||
|
||||
Reference in New Issue
Block a user