base structure

This commit is contained in:
redglow
2026-07-17 09:59:07 +02:00
parent e560a743fb
commit 96fffb2f9e
25 changed files with 466 additions and 55 deletions
+31
View File
@@ -0,0 +1,31 @@
#if TOOLS
using Godot;
using GodotHostTest.addons.godot_di;
namespace GodotHostTest.GodotDI;
public partial class ScopeInspectorPlugin : EditorInspectorPlugin
{
public override bool _CanHandle(GodotObject @object)
{
var result = @object.GetScript().AsGodotObject() is CSharpScript script &&
GodotScriptPathCache.TryGetTypeFromPath(script.ResourcePath, out var type) &&
type.IsAssignableTo(typeof(ServiceSource));
return result;
}
public override bool _ParseProperty(GodotObject @object, Variant.Type type, string name, PropertyHint hintType,
string hintString,
PropertyUsageFlags usageFlags, bool wide)
{
// We handle properties of type integer.
if (name != "_serviceScope") return false;
// Create an instance of the custom property editor and register
// it to a specific property path.
AddPropertyEditor(name, new ScopePickerEditor());
// Inform the editor to remove the default property editor for
// this property type.
return true;
}
}
#endif