Skip to content

Commit 290505e

Browse files
[Core] Fixes to handling of Guids from previous commit;
1 parent 3821d00 commit 290505e

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

Engine/Core/Audio/AudioSystem.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public void Update()
280280
{
281281
if(samples == null || channels == 0 || bits == 0 || sampleRate == 0)
282282
{
283-
Log.Debug($"[AudioSystem] Failed to load audio clip for {source.audioClip.Guid}");
283+
Log.Debug($"[AudioSystem] Failed to load audio clip for {source.audioClip.Guid.Guid}");
284284

285285
return;
286286
}
@@ -428,7 +428,7 @@ internal CancellationTokenSource LoadAudioClip(AudioClip clip, AudioClipLoadHand
428428

429429
if(stream == null)
430430
{
431-
Log.Debug($"[AudioSystem] Failed to get audio stream for {clip.Guid}");
431+
Log.Debug($"[AudioSystem] Failed to get audio stream for {clip.Guid.Guid}");
432432

433433
onFinish?.Invoke(default, 0, 0, 0);
434434

@@ -471,7 +471,7 @@ void Finish()
471471
}
472472
catch (Exception e)
473473
{
474-
Log.Debug($"[AudioClip] Failed to load audio clip {clip.Guid}: {e}");
474+
Log.Debug($"[AudioClip] Failed to load audio clip {clip.Guid.Guid}: {e}");
475475
}
476476

477477
return cts;

Engine/Core/Rendering/Mesh/MeshRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public sealed class MeshRenderer : Renderable, IComponentDisposable
2525

2626
public void DisposeComponent()
2727
{
28-
if(mesh != null && mesh.Guid == null)
28+
if(mesh != null && mesh.Guid?.Guid == null)
2929
{
3030
mesh.Destroy();
3131
}

Engine/Core/Rendering/Texture/Texture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ public RawTextureData GetRawTextureData()
622622
{
623623
if(readbackData == null)
624624
{
625-
Log.Error($"Texture {Guid} isn't readable (missing readback flag)");
625+
Log.Error($"Texture {Guid.Guid} isn't readable (missing readback flag)");
626626

627627
return null;
628628
}

Engine/Editor/EditorUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ public static void SaveAsset(IStapleAsset asset)
405405
{
406406
if(asset == null ||
407407
asset is not IGuidAsset guid ||
408-
guid.Guid == null)
408+
guid.Guid?.Guid == null)
409409
{
410410
return;
411411
}

Engine/Editor/Editors/Assets/MaterialEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ public override bool DrawProperty(Type fieldType, string name, Func<object> gett
5959
{
6060
if(newValue is Texture t)
6161
{
62-
var guid = t.Guid;
62+
var guid = t.Guid?.Guid;
6363

6464
if(guid != null)
6565
{
66-
parameter.Value.textureValue = guid.Guid;
66+
parameter.Value.textureValue = guid;
6767

68-
cachedTextures.AddOrSetKey(guid.Guid, t);
68+
cachedTextures.AddOrSetKey(guid, t);
6969
}
7070
}
7171
else

Engine/Editor/Editors/EditorGUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ public static object ObjectPicker(Type type, string name, object current, string
694694
{
695695
if(current is IGuidAsset g)
696696
{
697-
return g.Guid;
697+
return g.Guid.Guid;
698698
}
699699
else
700700
{

Engine/StapleCoreTests/Assets/AssetSerializationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ internal class StapleTypesAsset : IStapleAsset
5353

5454
internal class SimplePathAsset : IGuidAsset
5555
{
56-
private readonly GuidHasher guidhasher;
56+
private readonly GuidHasher guidhasher = new();
5757

5858
public GuidHasher Guid => guidhasher;
5959

@@ -184,7 +184,7 @@ public void TestSerialize()
184184
Assert.That(result.parameters[nameof(SimpleAsset.intValue)].value, Is.EqualTo(asset.intValue));
185185
Assert.That(result.parameters[nameof(SimpleAsset.stringValue)].value, Is.EqualTo(asset.stringValue));
186186
Assert.That(result.parameters[nameof(SimpleAsset.numbers)].value, Is.EqualTo(asset.numbers));
187-
Assert.That(result.parameters[nameof(SimpleAsset.pathAsset)].value, Is.EqualTo(asset.pathAsset.Guid));
187+
Assert.That(result.parameters[nameof(SimpleAsset.pathAsset)].value, Is.EqualTo(asset.pathAsset.Guid.Guid));
188188
Assert.That(result.parameters[nameof(SimpleAsset.enumValue)].value, Is.EqualTo(asset.enumValue.ToString()));
189189
});
190190

0 commit comments

Comments
 (0)