feat: aetherbind, first source generator

This commit is contained in:
redglow
2026-07-18 17:05:03 +02:00
parent 4ce99d9486
commit aae9c083d9
69 changed files with 210 additions and 156 deletions
@@ -0,0 +1,24 @@
using System;
using Godot;
namespace GodotHostTest.AetherBind;
public static class SceneInstantiatorExtensions
{
/// <summary>
/// Instantiate a packed scene, just like <see cref="PackedScene.Instantiate{T}" />, but also looks for a scope between
/// the top level children and triggers the dependency injection mechanism when found.
/// </summary>
/// <param name="sceneInstantiator">The scene instantiator to use.</param>
/// <param name="packedScene">The packed scene to instantiate.</param>
/// <param name="onScopeCreated">
/// An optional callback invoked once the scope has been created, but before instantiating the
/// scene.
/// </param>
/// <returns>The created node, with its dependencies satisfied.</returns>
private static T Instantiate<T>(this ISceneInstantiator sceneInstantiator, PackedScene packedScene,
Delegate? onScopeCreated = null) where T : Node
{
return (T)sceneInstantiator.Instantiate(packedScene, onScopeCreated);
}
}