Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion scripts/database/settings/SettingsProfile.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Godot;

Expand Down Expand Up @@ -624,7 +625,7 @@ public SettingsProfile()
UpdateAction = (_, init) => { if (!init) { SkinManager.Load(); } },
List = new("skin")
{
Values = ["skin", "squircle", "square"]
Values = getAvailableMeshes()
}
};

Expand Down Expand Up @@ -1097,4 +1098,21 @@ private void updateApproachTime()
{
ApproachTime.Value = ApproachDistance / ApproachRate;
}

private static List<string> getAvailableMeshes()
{
List<string> meshes = ["skin"];
string meshDir = $"{Constants.USER_FOLDER}/meshes";

if (Directory.Exists(meshDir))
{
string[] objFiles = Directory.GetFiles(meshDir, "*.obj");
foreach (string file in objFiles)
{
meshes.Add(Path.GetFileNameWithoutExtension(file));
}
}

return meshes;
}
}
7 changes: 7 additions & 0 deletions scripts/game/LegacyRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public partial class LegacyRenderer : MultiMeshInstance3D
public override void _Ready()
{
settings = SettingsManager.Instance.Settings;
Multimesh.Mesh = SkinManager.Instance.Skin.NoteMesh;
SkinManager.Instance.Loaded += onSkinLoaded;
}

public override void _Process(double delta)
Expand Down Expand Up @@ -80,4 +82,9 @@ public override void _Process(double delta)
Multimesh.SetInstanceColor(j, color);
}
}

private void onSkinLoaded(SkinProfile skin)
{
Multimesh.Mesh = skin.NoteMesh;
}
}
Loading