diff options
author | Paul Joannon <hello@pauljoannon.com> | 2024-02-01 21:06:17 +0100 |
---|---|---|
committer | Paul Joannon <hello@pauljoannon.com> | 2024-02-01 22:06:40 +0100 |
commit | 999180d5b5c1023f441100e7b45a3aa346a2e898 (patch) | |
tree | ef917c8cd52bc296e15deea50471f20dd5ee3d36 | |
parent | 9adb7c7d130c6d4eb0e80b92d6eebd71fac3384d (diff) | |
download | redot-engine-999180d5b5c1023f441100e7b45a3aa346a2e898.tar.gz |
Delay fs update when populating path bimap
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs | 17 | ||||
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.types.cs | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs index 968afa664b..e344dc84c7 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs @@ -310,13 +310,6 @@ namespace Godot.Bridge _pathTypeBiMap.Add(scriptPathAttr.Path, type); - // This method may be called before initialization. - if (NativeFuncs.godotsharp_dotnet_module_is_initialized().ToBool() && Engine.IsEditorHint()) - { - using godot_string scriptPath = Marshaling.ConvertStringToNative(scriptPathAttr.Path); - NativeFuncs.godotsharp_internal_editor_file_system_update_file(scriptPath); - } - if (AlcReloadCfg.IsAlcReloadingEnabled) { AddTypeForAlcReloading(type); @@ -366,6 +359,16 @@ namespace Godot.Bridge } } } + + // This method may be called before initialization. + if (NativeFuncs.godotsharp_dotnet_module_is_initialized().ToBool() && Engine.IsEditorHint()) + { + foreach (var scriptPath in _pathTypeBiMap.Paths) + { + using godot_string nativeScriptPath = Marshaling.ConvertStringToNative(scriptPath); + NativeFuncs.godotsharp_internal_editor_file_system_update_file(nativeScriptPath); + } + } } [UnmanagedCallersOnly] diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.types.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.types.cs index a58f6849ad..7fa3498b92 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.types.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.types.cs @@ -61,6 +61,8 @@ public static partial class ScriptManagerBridge private System.Collections.Generic.Dictionary<string, Type> _pathTypeMap = new(); private System.Collections.Generic.Dictionary<Type, string> _typePathMap = new(); + public System.Collections.Generic.IEnumerable<string> Paths => _pathTypeMap.Keys; + public void Add(string scriptPath, Type scriptType) { _pathTypeMap.Add(scriptPath, scriptType); |