Minor tweaks to Gameplay Globals

#2412
This commit is contained in:
Wojtek Figat
2024-04-14 00:09:29 +02:00
parent c59e872ef2
commit 53689063b9
2 changed files with 8 additions and 7 deletions

View File

@@ -494,6 +494,7 @@ namespace FlaxEditor.Windows.Assets
_undo.Enabled = false;
_undo.Clear();
_propertiesEditor.BuildLayoutOnUpdate();
UpdateToolstrip();
}
/// <inheritdoc />
@@ -504,6 +505,7 @@ namespace FlaxEditor.Windows.Assets
_undo.Enabled = true;
_undo.Clear();
_propertiesEditor.BuildLayoutOnUpdate();
UpdateToolstrip();
}
/// <inheritdoc />

View File

@@ -221,9 +221,7 @@ Asset::LoadResult GameplayGlobals::load()
// Get data
const auto chunk = GetChunk(0);
if (!chunk || !chunk->IsLoaded())
{
return LoadResult::MissingDataChunk;
}
MemoryReadStream stream(chunk->Get(), chunk->Size());
// Load all variables
@@ -234,15 +232,16 @@ Asset::LoadResult GameplayGlobals::load()
for (int32 i = 0; i < count; i++)
{
stream.ReadString(&name, 71);
if (name.IsEmpty())
{
LOG(Warning, "Empty variable name");
return LoadResult::InvalidData;
}
auto& e = Variables[name];
stream.ReadVariant(&e.DefaultValue);
e.Value = e.DefaultValue;
}
if (stream.HasError())
{
// Failed to load data
Variables.Clear();
return LoadResult::InvalidData;
}
return LoadResult::Ok;
}