Spawn actor node added

This commit is contained in:
barsdeveloper
2023-04-09 21:59:27 +02:00
parent 2a7f208070
commit f373ec98b0
7 changed files with 89 additions and 25 deletions

View File

@@ -234,6 +234,30 @@ const tests = [
delegate: false,
development: false,
},
{
name: "SpawnActor NONE",
value: String.raw`
Begin Object Class=/Script/BlueprintGraph.K2Node_SpawnActorFromClass Name="K2Node_SpawnActorFromClass_0"
NodePosX=-448
NodePosY=480
AdvancedPinDisplay=Shown
NodeGuid=67F74CB6B29D46AEB9792421DFF77A8F
CustomProperties Pin (PinId=CA79FC6F9F644CD2A0DF687BB21CE6AB,PinName="execute",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=D28ECFB26CE24887B4346F67E4043981,PinName="then",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=7D55CDF20E8B4CDCBCB5EA18567D53A7,PinName="Class",PinToolTip="Actor Class Reference Class\nThe object class you want to construct",PinType.PinCategory="class",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/Engine.Actor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=9C7E2637A9414DC8B473A7F67D31E2FC,PinName="ReturnValue",PinToolTip="Actor Object Reference Return Value\nThe constructed object",Direction="EGPD_Output",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/Engine.Actor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=B9D43AB9107148C38218398D504CC3C2,PinName="SpawnTransform",PinToolTip="Spawn Transform\nTransform\n\nThe transform to spawn the Actor with",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Transform"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=7FD38D6A62F442CF8E76158F77E8D16B,PinName="CollisionHandlingOverride",PinToolTip="Collision Handling Override\nESpawnActorCollisionHandlingMethod Enum\n\nSpecifies how to handle collisions at the spawn point. If undefined, uses actor class settings.",PinType.PinCategory="byte",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Enum'"/Script/Engine.ESpawnActorCollisionHandlingMethod"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="AlwaysSpawn",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=3221E284C4D3436DA7BD2FA07D8B5EB1,PinName="Owner",PinToolTip="Owner\nActor Object Reference\n\nCan be left empty; primarily used for replication (bNetUseOwnerRelevancy and bOnlyRelevantToOwner), or visibility (PrimitiveComponent\'s bOwnerNoSee/bOnlyOwnerSee)",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/Engine.Actor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
End Object
`,
color: Configuration.nodeColors.blue,
icon: SVGIcon.spawnActor,
pins: 8,
pinNames: ["Class", "Spawn Transform", "Collision Handling Override", "Owner", "Return Value"],
delegate: false,
development: false,
},
]
/** @type {Blueprint} */

42
dist/ueblueprint.js vendored
View File

@@ -141,6 +141,7 @@ class Configuration {
promotableOperator: "/Script/BlueprintGraph.K2Node_PromotableOperator",
reverseForEachLoop: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:ReverseForEachLoop",
select: "/Script/BlueprintGraph.K2Node_Select",
spawnActorFromClass: "/Script/BlueprintGraph.K2Node_SpawnActorFromClass",
switchEnum: "/Script/BlueprintGraph.K2Node_SwitchEnum",
userDefinedEnum: "/Script/Engine.UserDefinedEnum",
variableGet: "/Script/BlueprintGraph.K2Node_VariableGet",
@@ -2036,8 +2037,10 @@ class PinEntity extends IEntity {
showDefault: false,
},
DefaultValue: {
/** @param {PinEntity} pinEntity */
type: new ComputedType(pinEntity => pinEntity.getEntityType(true) ?? String),
type: new ComputedType(
/** @param {PinEntity} pinEntity */
pinEntity => pinEntity.getEntityType(true) ?? String
),
serialized: true,
showDefault: false,
},
@@ -2103,13 +2106,7 @@ class PinEntity extends IEntity {
if (this.PinType.PinCategory === "struct" || this.PinType.PinCategory === "object") {
return subCategory.path
}
if (
this.PinType.PinCategory === "byte"
&& (
subCategory.type === Configuration.nodeType.enum
|| subCategory.type === Configuration.nodeType.userDefinedEnum
)
) {
if (this.isEnum()) {
return "enum"
}
return this.PinType.PinCategory
@@ -2161,6 +2158,13 @@ class PinEntity extends IEntity {
return this.DefaultValue
}
isEnum() {
const type = this.PinType.PinSubCategoryObject.type;
return type === Configuration.nodeType.enum
|| type === Configuration.nodeType.userDefinedEnum
|| type.toLowerCase() === "enum"
}
isExecution() {
return this.PinType.PinCategory === "exec"
}
@@ -2531,6 +2535,16 @@ class SVGIcon {
</svg>
`
static spawnActor = y`
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.38 12.62L7 11.5L10.38 10.38L11.5 7L12.63 10.38L16 11.5L12.63 12.62L11.5 16L10.38 12.62Z" fill="white"/>
<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M4 14H2L3 10L0 14V16H10L9 14H4Z" fill="white"/>
<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M2 6C1.9996 7.10384 2.30372 8.1864 2.87889 9.12854C3.45406 10.0707 4.27798 10.8359 5.26 11.34L9 9L11.5 5L13.78 7.6C13.9251 7.07902 13.9991 6.54081 14 6C14 4.4087 13.3679 2.88258 12.2426 1.75736C11.1174 0.63214 9.5913 0 8 0C6.4087 0 4.88258 0.63214 3.75736 1.75736C2.63214 2.88258 2 4.4087 2 6V6Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.22005 0.810059H8.00005C6.62265 0.810056 5.30153 1.35654 4.32663 2.32957C3.35172 3.30259 2.8027 4.62266 2.80005 6.00006C2.79984 7.03987 3.11257 8.05567 3.69756 8.91532C4.28255 9.77497 5.11271 10.4387 6.08005 10.8201L7.17005 10.1401C6.16687 9.86642 5.28119 9.27116 4.64894 8.44562C4.01669 7.62008 3.6728 6.60989 3.67005 5.57006C3.66886 4.34318 4.14143 3.16323 4.98917 2.27635C5.83692 1.38948 6.99437 0.864185 8.22005 0.810059V0.810059Z" fill="white"/>
<path d="M10.0401 5.16001C10.7028 5.16001 11.2401 4.62275 11.2401 3.96001C11.2401 3.29727 10.7028 2.76001 10.0401 2.76001C9.37735 2.76001 8.84009 3.29727 8.84009 3.96001C8.84009 4.62275 9.37735 5.16001 10.0401 5.16001Z" fill="white"/>
</svg>
`
static switch = y`
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3" y="2" width="6" height="2" fill="white" />
@@ -3017,12 +3031,17 @@ class ObjectEntity extends IEntity {
return "For Each Loop with Break"
case Configuration.nodeType.ifThenElse:
return "Branch"
case Configuration.nodeType.spawnActorFromClass:
return `SpawnActor ${Utility.formatStringName(
this.CustomProperties.find(pinEntity => pinEntity.getType() == "class")?.DefaultObject?.getName()
?? "NONE"
)}`
case Configuration.nodeType.switchEnum:
return `Switch on ${this.Enum?.getName() ?? "Enum"}`
case Configuration.nodeType.variableGet:
return ""
case Configuration.nodeType.variableSet:
return "SET"
case Configuration.nodeType.switchEnum:
return `Switch on ${this.Enum?.getName() ?? "Enum"}`
}
const keyNameSymbol = this.getHIDAttribute();
if (keyNameSymbol) {
@@ -3165,6 +3184,7 @@ class ObjectEntity extends IEntity {
case Configuration.nodeType.makeMap: return SVGIcon.makeMap
case Configuration.nodeType.makeSet: return SVGIcon.makeSet
case Configuration.nodeType.select: return SVGIcon.select
case Configuration.nodeType.spawnActorFromClass: return SVGIcon.spawnActor
case Configuration.nodeType.switchEnum: return SVGIcon.switch
}
if (this.nodeDisplayName().startsWith("Break")) {

File diff suppressed because one or more lines are too long

View File

@@ -117,6 +117,7 @@ export default class Configuration {
promotableOperator: "/Script/BlueprintGraph.K2Node_PromotableOperator",
reverseForEachLoop: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:ReverseForEachLoop",
select: "/Script/BlueprintGraph.K2Node_Select",
spawnActorFromClass: "/Script/BlueprintGraph.K2Node_SpawnActorFromClass",
switchEnum: "/Script/BlueprintGraph.K2Node_SwitchEnum",
userDefinedEnum: "/Script/Engine.UserDefinedEnum",
variableGet: "/Script/BlueprintGraph.K2Node_VariableGet",

View File

@@ -300,6 +300,16 @@ export default class SVGIcon {
</svg>
`
static spawnActor = html`
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.38 12.62L7 11.5L10.38 10.38L11.5 7L12.63 10.38L16 11.5L12.63 12.62L11.5 16L10.38 12.62Z" fill="white"/>
<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M4 14H2L3 10L0 14V16H10L9 14H4Z" fill="white"/>
<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M2 6C1.9996 7.10384 2.30372 8.1864 2.87889 9.12854C3.45406 10.0707 4.27798 10.8359 5.26 11.34L9 9L11.5 5L13.78 7.6C13.9251 7.07902 13.9991 6.54081 14 6C14 4.4087 13.3679 2.88258 12.2426 1.75736C11.1174 0.63214 9.5913 0 8 0C6.4087 0 4.88258 0.63214 3.75736 1.75736C2.63214 2.88258 2 4.4087 2 6V6Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.22005 0.810059H8.00005C6.62265 0.810056 5.30153 1.35654 4.32663 2.32957C3.35172 3.30259 2.8027 4.62266 2.80005 6.00006C2.79984 7.03987 3.11257 8.05567 3.69756 8.91532C4.28255 9.77497 5.11271 10.4387 6.08005 10.8201L7.17005 10.1401C6.16687 9.86642 5.28119 9.27116 4.64894 8.44562C4.01669 7.62008 3.6728 6.60989 3.67005 5.57006C3.66886 4.34318 4.14143 3.16323 4.98917 2.27635C5.83692 1.38948 6.99437 0.864185 8.22005 0.810059V0.810059Z" fill="white"/>
<path d="M10.0401 5.16001C10.7028 5.16001 11.2401 4.62275 11.2401 3.96001C11.2401 3.29727 10.7028 2.76001 10.0401 2.76001C9.37735 2.76001 8.84009 3.29727 8.84009 3.96001C8.84009 4.62275 9.37735 5.16001 10.0401 5.16001Z" fill="white"/>
</svg>
`
static switch = html`
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3" y="2" width="6" height="2" fill="white" />

View File

@@ -444,12 +444,17 @@ export default class ObjectEntity extends IEntity {
return "For Each Loop with Break"
case Configuration.nodeType.ifThenElse:
return "Branch"
case Configuration.nodeType.spawnActorFromClass:
return `SpawnActor ${Utility.formatStringName(
this.CustomProperties.find(pinEntity => pinEntity.getType() == "class")?.DefaultObject?.getName()
?? "NONE"
)}`
case Configuration.nodeType.switchEnum:
return `Switch on ${this.Enum?.getName() ?? "Enum"}`
case Configuration.nodeType.variableGet:
return ""
case Configuration.nodeType.variableSet:
return "SET"
case Configuration.nodeType.switchEnum:
return `Switch on ${this.Enum?.getName() ?? "Enum"}`
}
const keyNameSymbol = this.getHIDAttribute()
if (keyNameSymbol) {
@@ -592,6 +597,7 @@ export default class ObjectEntity extends IEntity {
case Configuration.nodeType.makeMap: return SVGIcon.makeMap
case Configuration.nodeType.makeSet: return SVGIcon.makeSet
case Configuration.nodeType.select: return SVGIcon.select
case Configuration.nodeType.spawnActorFromClass: return SVGIcon.spawnActor
case Configuration.nodeType.switchEnum: return SVGIcon.switch
}
if (this.nodeDisplayName().startsWith("Break")) {

View File

@@ -86,8 +86,10 @@ export default class PinEntity extends IEntity {
showDefault: false,
},
DefaultValue: {
/** @param {PinEntity} pinEntity */
type: new ComputedType(pinEntity => pinEntity.getEntityType(true) ?? String),
type: new ComputedType(
/** @param {PinEntity} pinEntity */
pinEntity => pinEntity.getEntityType(true) ?? String
),
serialized: true,
showDefault: false,
},
@@ -153,13 +155,7 @@ export default class PinEntity extends IEntity {
if (this.PinType.PinCategory === "struct" || this.PinType.PinCategory === "object") {
return subCategory.path
}
if (
this.PinType.PinCategory === "byte"
&& (
subCategory.type === Configuration.nodeType.enum
|| subCategory.type === Configuration.nodeType.userDefinedEnum
)
) {
if (this.isEnum()) {
return "enum"
}
return this.PinType.PinCategory
@@ -211,6 +207,13 @@ export default class PinEntity extends IEntity {
return this.DefaultValue
}
isEnum() {
const type = this.PinType.PinSubCategoryObject.type
return type === Configuration.nodeType.enum
|| type === Configuration.nodeType.userDefinedEnum
|| type.toLowerCase() === "enum"
}
isExecution() {
return this.PinType.PinCategory === "exec"
}