Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
StudyFramework Plugin
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LuFG VR VIS
VR-Group
Unreal-Development
Plugins
StudyFramework Plugin
Commits
55cf2abb
Commit
55cf2abb
authored
9 months ago
by
Jonathan Ehret
Browse files
Options
Downloads
Patches
Plain Diff
fix to not being able to load a map and then switch back to the study setup map
parent
d0144af0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Source/StudyFrameworkPlugin/Private/SFMapFactor.cpp
+12
-12
12 additions, 12 deletions
Source/StudyFrameworkPlugin/Private/SFMapFactor.cpp
with
12 additions
and
12 deletions
Source/StudyFrameworkPlugin/Private/SFMapFactor.cpp
+
12
−
12
View file @
55cf2abb
...
...
@@ -19,24 +19,22 @@ void USFMapFactor::FromJson(TSharedPtr<FJsonObject> Json)
for
(
FString
LevelName
:
Levels
)
{
//we had issues with maps being loaded once in the editor and then on starting the study this method
//was called again in PostLoad() and tried to reload an already loaded map which caused crashes
//with the if-clause below we do not load the maps when starting the study, where we don't need the
//asset pointer anyways since the study itself only uses the Levels strings directly
UWorld
*
World
=
GetWorld
();
if
(
World
&&
World
->
WorldType
!=
EWorldType
::
PIE
&&
World
->
WorldType
!=
EWorldType
::
Game
)
{
TSoftObjectPtr
<
UWorld
>
LevelObj
=
StaticLoadObject
(
UWorld
::
StaticClass
(),
nullptr
,
*
LevelName
,
nullptr
,
LOAD_Verify
|
LOAD_Quiet
);
Maps
.
Add
(
LevelObj
.
Get
());
}
// we need to transform /Path/To/Asset into /Path/To/Asset.Asset;
TArray
<
FString
>
Parts
;
LevelName
.
ParseIntoArray
(
Parts
,
TEXT
(
"/"
),
true
);
FString
LevelNameFull
=
LevelName
+
"."
+
Parts
[
Parts
.
Num
()
-
1
];
FSoftObjectPath
LevelPath
(
LevelNameFull
);
TSoftObjectPtr
<
UWorld
>
LevelObj
(
LevelPath
);
LevelObj
.
ToSoftObjectPath
().
PostLoadPath
(
nullptr
);
Maps
.
Add
(
LevelObj
);
}
}
#if WITH_EDITOR
bool
USFMapFactor
::
CanEditChange
(
const
FProperty
*
InProperty
)
const
{
//just use this to not allow editing "Levels" directly at all
//
just use this to not allow editing "Levels" directly at all
if
(
InProperty
->
GetFName
()
==
"Levels"
)
{
return
false
;
...
...
@@ -54,6 +52,8 @@ void USFMapFactor::PostEditChangeProperty(FPropertyChangedEvent& PropertyChanged
Levels
.
Empty
();
for
(
TSoftObjectPtr
<
UWorld
>
Map
:
Maps
)
{
// we want to store the name as /Path/To/Asset not as /Path/To/Asset.Asset
// this is beneficial for readability and also needed for loading the levels as is now
FSoftObjectPath
Path
=
Map
.
ToSoftObjectPath
();
FString
PathString
=
Path
.
GetAssetPathString
();
int32
DotIndex
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment