Reload on resource external change
This commit is contained in:
parent
2e750228e1
commit
5680ecc17e
2 changed files with 25 additions and 3 deletions
|
|
@ -13,6 +13,11 @@ public partial class AdventureEditor : MarginContainer
|
|||
[Signal]
|
||||
public delegate void HardReloadRequestedEventHandler();
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
EditorInterface.Singleton.GetInspector().PropertyEdited += OnInspectorPropertyChanged;
|
||||
}
|
||||
|
||||
public void Reload()
|
||||
{
|
||||
EmitSignal(SignalName.ReloadRequested);
|
||||
|
|
@ -33,5 +38,12 @@ public partial class AdventureEditor : MarginContainer
|
|||
}
|
||||
ResourceSaver.Save(editedResource, editedPath);
|
||||
}
|
||||
|
||||
public void OnInspectorPropertyChanged(string property)
|
||||
{
|
||||
if (EditorInterface.Singleton.GetInspector().GetEditedObject() is AdventureLevelResource resource)
|
||||
{
|
||||
editedPath = resource.ResourcePath;
|
||||
HardReload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue