Skip to content

Commit

Permalink
feat: Confirma can operate from a location other than the default
Browse files Browse the repository at this point in the history
  • Loading branch information
MASSHUU12 committed Jul 24, 2024
1 parent 6a6408f commit 27d1239
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions addons/confirma/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ public partial class Plugin : EditorPlugin

public override void _EnterTree()
{
_testBottomPanel = GD.Load<PackedScene>("uid://bl21wviqvff84").Instantiate<Control>();
_testBottomPanel = GD.Load<PackedScene>(
GetPluginPath() + "/src/scenes/test_bottom_panel/TestBottomPanel.tscn"
).Instantiate<Control>();
_ = AddControlToBottomPanel(_testBottomPanel, "Confirma");

AddAutoloadSingleton("Confirma", "res://addons/confirma/src/scenes/confirma_autoload/ConfirmaAutoload.tscn");
AddControlToBottomPanel(_testBottomPanel, "Confirma");
AddAutoloadSingleton("Confirma", GetPluginPath() + "/src/scenes/confirma_autoload/ConfirmaAutoload.tscn");

GD.Print("Confirma is ready!");
}
Expand All @@ -27,5 +29,10 @@ public override void _ExitTree()

GD.Print("Confirma is disabled!");
}

private string GetPluginPath()
{
return GetScript().As<Script>().ResourcePath.GetBaseDir();
}
}
#endif

0 comments on commit 27d1239

Please sign in to comment.