Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Kyrium
KBFL
Commits
d3d56775
Commit
d3d56775
authored
Dec 30, 2021
by
Kyrium
Browse files
fix an error
parent
5199846e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Source/KBFL/Private/Subsystems/ResourceNodes/KBFLActorSpawnDescriptorBase.cpp
View file @
d3d56775
...
@@ -115,16 +115,22 @@ void UKBFLActorSpawnDescriptorBase::RemoveWrongActors(TArray<FTransform>& Transf
...
@@ -115,16 +115,22 @@ void UKBFLActorSpawnDescriptorBase::RemoveWrongActors(TArray<FTransform>& Transf
}
}
}
}
void
UKBFLActorSpawnDescriptorBase
::
ApplyMaterialData
(
AActor
*
Actor
,
TMap
<
uint8
,
UMaterial
*>
MaterialInfo
)
void
UKBFLActorSpawnDescriptorBase
::
ApplyMaterialData
(
AActor
*
Actor
,
TMap
<
uint8
,
UMaterial
Interface
*>
MaterialInfo
)
{
{
UStaticMeshComponent
*
StaticMesh
=
Cast
<
UStaticMeshComponent
>
(
Actor
->
GetComponentByClass
(
UStaticMeshComponent
::
StaticClass
()));
if
(
Actor
&&
MaterialInfo
.
Num
()
>
0
)
if
(
StaticMesh
&&
MaterialInfo
.
Num
()
>
0
)
{
{
for
(
auto
Info
:
MaterialInfo
)
if
(
UActorComponent
*
PrimitiveComponent
=
Actor
->
GetComponentByClass
(
UStaticMeshComponent
::
StaticClass
())
)
{
{
if
(
StaticMesh
->
GetNumMaterials
()
>
Info
.
Key
&&
Info
.
Value
)
UStaticMeshComponent
*
StaticMesh
=
Cast
<
UStaticMeshComponent
>
(
PrimitiveComponent
);
if
(
StaticMesh
)
{
{
StaticMesh
->
SetMaterial
(
Info
.
Key
,
Info
.
Value
);
for
(
auto
Info
:
MaterialInfo
)
{
if
(
StaticMesh
->
GetNumMaterials
()
>
Info
.
Key
&&
Info
.
Value
)
{
StaticMesh
->
SetMaterial
(
Info
.
Key
,
Info
.
Value
);
}
}
}
}
}
}
}
}
...
...
Source/KBFL/Private/Subsystems/ResourceNodes/KBFLResourceNodeDescriptor_ResourceNode.cpp
View file @
d3d56775
...
@@ -13,7 +13,7 @@ void UKBFLResourceNodeDescriptor_ResourceNode::ForeachLocations(TArray<FTransfor
...
@@ -13,7 +13,7 @@ void UKBFLResourceNodeDescriptor_ResourceNode::ForeachLocations(TArray<FTransfor
AActor
*
OutActor
;
AActor
*
OutActor
;
if
(
!
CheckActorInRange
(
Location
,
OutActor
)
&&
IsRangeFree
(
Location
))
if
(
!
CheckActorInRange
(
Location
,
OutActor
)
&&
IsRangeFree
(
Location
))
{
{
SpawnActorAtLocation
(
Location
,
GetActorClass
());
OutActor
=
SpawnActorAtLocation
(
Location
,
GetActorClass
());
}
}
if
(
OutActor
)
if
(
OutActor
)
...
...
Source/KBFL/Public/Subsystems/ResourceNodes/KBFLActorSpawnDescriptorBase.h
View file @
d3d56775
...
@@ -32,7 +32,7 @@ class KBFL_API UKBFLActorSpawnDescriptorBase : public UObject
...
@@ -32,7 +32,7 @@ class KBFL_API UKBFLActorSpawnDescriptorBase : public UObject
virtual
void
ModifySpawnedActorPostSpawn
(
AActor
*&
InActor
);
virtual
void
ModifySpawnedActorPostSpawn
(
AActor
*&
InActor
);
virtual
void
AfterSpawning
()
{};
virtual
void
AfterSpawning
()
{};
void
ApplyMaterialData
(
AActor
*
Actor
,
TMap
<
uint8
,
UMaterial
*>
MaterialInfo
);
void
ApplyMaterialData
(
AActor
*
Actor
,
TMap
<
uint8
,
UMaterial
Interface
*>
MaterialInfo
);
virtual
bool
IsAllowedToRemoveActor
(
AActor
*
InActor
);
virtual
bool
IsAllowedToRemoveActor
(
AActor
*
InActor
);
bool
CheckWorld
()
const
;
bool
CheckWorld
()
const
;
...
...
Source/KBFL/Public/Subsystems/ResourceNodes/KBFLResourceNodeDescriptor_ResourceNode.h
View file @
d3d56775
...
@@ -52,5 +52,5 @@ class KBFL_API UKBFLResourceNodeDescriptor_ResourceNode : public UKBFLResourceNo
...
@@ -52,5 +52,5 @@ class KBFL_API UKBFLResourceNodeDescriptor_ResourceNode : public UKBFLResourceNo
TSubclassOf
<
AFGResourceNodeBase
>
mResourceNodeClass
=
nullptr
;
TSubclassOf
<
AFGResourceNodeBase
>
mResourceNodeClass
=
nullptr
;
UPROPERTY
(
EditDefaultsOnly
,
BlueprintReadWrite
,
Category
=
"Resource Node"
)
UPROPERTY
(
EditDefaultsOnly
,
BlueprintReadWrite
,
Category
=
"Resource Node"
)
TMap
<
uint8
,
UMaterial
*>
mResourceNodeMaterialInfo
;
TMap
<
uint8
,
UMaterial
Interface
*>
mResourceNodeMaterialInfo
;
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment