// Copyright © Gamesmiths Guild.
#if TOOLS
using Gamesmiths.Forge.Godot.Resources;
using Godot;
namespace Gamesmiths.Forge.Godot.Editor.Statescript;
///
/// Inspector plugin that replaces the default array editor with a
/// polished UI matching the graph variable panel style.
///
public partial class SharedVariableSetInspectorPlugin : EditorInspectorPlugin
{
private EditorUndoRedoManager? _undoRedo;
///
/// Sets the used for undo/redo support.
///
/// The undo/redo manager from the editor plugin.
public void SetUndoRedo(EditorUndoRedoManager undoRedo)
{
_undoRedo = undoRedo;
}
///
public override bool _CanHandle(GodotObject @object)
{
return @object is ForgeSharedVariableSet;
}
///
public override bool _ParseProperty(
GodotObject @object,
Variant.Type type,
string name,
PropertyHint hintType,
string hintString,
PropertyUsageFlags usageFlags,
bool wide)
{
if (name != "Variables")
{
return false;
}
var editorProperty = new SharedVariableSetEditorProperty();
editorProperty.SetUndoRedo(_undoRedo);
AddPropertyEditor(name, editorProperty);
return true;
}
}
#endif