gdharness 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -79,6 +79,7 @@ func _init_tools() -> void:
|
|
|
79
79
|
"disconnect_signal": [_scene_tools, "disconnect_signal"],
|
|
80
80
|
"list_connections": [_scene_tools, "list_connections"],
|
|
81
81
|
"rescan_filesystem": [_scene_tools, "rescan_filesystem"],
|
|
82
|
+
"scan_status": [_scene_tools, "scan_status"],
|
|
82
83
|
"global_classes": [_class_tools, "global_classes"],
|
|
83
84
|
"reload_script": [_class_tools, "reload_script"],
|
|
84
85
|
# Settings, for a caller that asked the editor rather than the file on disk
|
|
@@ -18,6 +18,12 @@ var _scans_finished: int = 0
|
|
|
18
18
|
var _scans_finished_at_request: int = 0
|
|
19
19
|
var _scan_pending: bool = false
|
|
20
20
|
|
|
21
|
+
## When the last scan finished, on the engine's clock, or -1 before the first. The editor writes
|
|
22
|
+
## the class cache a frame after it stops reporting a scan, measured on 4.7.2, so a game started
|
|
23
|
+
## in between reads a file being rewritten; how long ago the scan ended is what tells a caller
|
|
24
|
+
## whether that write can still be coming.
|
|
25
|
+
var _scan_finished_at_msec: int = -1
|
|
26
|
+
|
|
21
27
|
|
|
22
28
|
func set_editor_plugin(plugin: EditorPlugin) -> void:
|
|
23
29
|
_editor_plugin = plugin
|
|
@@ -31,6 +37,7 @@ func set_editor_plugin(plugin: EditorPlugin) -> void:
|
|
|
31
37
|
func _scan_finished() -> void:
|
|
32
38
|
_scans_finished += 1
|
|
33
39
|
_scan_pending = false
|
|
40
|
+
_scan_finished_at_msec = Time.get_ticks_msec()
|
|
34
41
|
|
|
35
42
|
|
|
36
43
|
func _refresh_and_reload(scene_path: String) -> void:
|
|
@@ -675,3 +682,22 @@ func rescan_filesystem(args: Dictionary) -> Dictionary:
|
|
|
675
682
|
"pending": _scan_pending,
|
|
676
683
|
"scansFinished": _scans_finished,
|
|
677
684
|
}
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
## Whether the editor is scanning, and how long ago its last scan finished, without asking for one.
|
|
688
|
+
##
|
|
689
|
+
## For a caller about to start a game: the editor rewrites the class cache a frame after a scan
|
|
690
|
+
## stops reporting, so a game booted during the scan or in that frame reads a file being rewritten.
|
|
691
|
+
## Apart from `rescan_filesystem` because asking must not start or count anything.
|
|
692
|
+
func scan_status(_args: Dictionary) -> Dictionary:
|
|
693
|
+
if not _editor_plugin:
|
|
694
|
+
return {"ok": false, "error": "Editor plugin unavailable"}
|
|
695
|
+
var filesystem: EditorFileSystem = EditorInterface.get_resource_filesystem()
|
|
696
|
+
return {
|
|
697
|
+
"ok": true,
|
|
698
|
+
"scanning": filesystem.is_scanning(),
|
|
699
|
+
"importing": filesystem.is_importing(),
|
|
700
|
+
"pending": _scan_pending,
|
|
701
|
+
"sinceScanFinishedMs":
|
|
702
|
+
-1 if _scan_finished_at_msec < 0 else Time.get_ticks_msec() - _scan_finished_at_msec,
|
|
703
|
+
}
|