gdharness 1.3.0 → 1.3.2

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.
Files changed (72) hide show
  1. package/build/cli.js +322 -96
  2. package/build/godot/addons/gdharness_editor/animation_reads.gd +7 -19
  3. package/build/godot/addons/gdharness_editor/bridge_client.gd +8 -8
  4. package/build/godot/addons/gdharness_editor/declared_values.gd +116 -0
  5. package/build/godot/addons/gdharness_editor/declared_values.gd.uid +1 -0
  6. package/build/godot/addons/gdharness_editor/file_reads.gd +65 -25
  7. package/build/godot/addons/gdharness_editor/headless_check.gd +7 -7
  8. package/build/godot/addons/gdharness_editor/plugin.gd +6 -6
  9. package/build/godot/addons/gdharness_editor/property_values.gd +222 -59
  10. package/build/godot/addons/gdharness_editor/reading.gd +65 -0
  11. package/build/godot/addons/gdharness_editor/scene_file.gd +28 -23
  12. package/build/godot/addons/gdharness_editor/serialisation.gd +49 -94
  13. package/build/godot/addons/gdharness_editor/tool_executor.gd +24 -24
  14. package/build/godot/addons/gdharness_editor/tools/animation_tools.gd +52 -41
  15. package/build/godot/addons/gdharness_editor/tools/filesystem_tools.gd +4 -4
  16. package/build/godot/addons/gdharness_editor/tools/play_tools.gd +2 -2
  17. package/build/godot/addons/gdharness_editor/tools/profile_tools.gd +14 -14
  18. package/build/godot/addons/gdharness_editor/tools/resource_tools.gd +175 -74
  19. package/build/godot/addons/gdharness_editor/tools/scene_kin.gd +17 -17
  20. package/build/godot/addons/gdharness_editor/tools/scene_paths.gd +14 -12
  21. package/build/godot/addons/gdharness_editor/tools/scene_placing.gd +7 -7
  22. package/build/godot/addons/gdharness_editor/tools/scene_tools.gd +88 -84
  23. package/build/godot/addons/gdharness_editor/tools/settings_tools.gd +4 -4
  24. package/build/godot/addons/gdharness_editor/value_shapes.gd +118 -0
  25. package/build/godot/addons/gdharness_editor/value_shapes.gd.uid +1 -0
  26. package/build/godot/addons/gdharness_runtime/reading.gd +65 -0
  27. package/build/godot/addons/gdharness_runtime/runtime_accessibility.gd +18 -18
  28. package/build/godot/addons/gdharness_runtime/runtime_autoload.gd +29 -29
  29. package/build/godot/addons/gdharness_runtime/runtime_capture.gd +21 -18
  30. package/build/godot/addons/gdharness_runtime/runtime_changes.gd +86 -80
  31. package/build/godot/addons/gdharness_runtime/runtime_input.gd +65 -64
  32. package/build/godot/addons/gdharness_runtime/runtime_items.gd +6 -6
  33. package/build/godot/addons/gdharness_runtime/runtime_menus.gd +8 -8
  34. package/build/godot/addons/gdharness_runtime/runtime_mouse.gd +6 -6
  35. package/build/godot/addons/gdharness_runtime/runtime_pad.gd +10 -10
  36. package/build/godot/addons/gdharness_runtime/runtime_paths.gd +7 -7
  37. package/build/godot/addons/gdharness_runtime/runtime_queries.gd +41 -41
  38. package/build/godot/addons/gdharness_runtime/runtime_says.gd +3 -3
  39. package/build/godot/addons/gdharness_runtime/runtime_targets.gd +33 -33
  40. package/build/godot/addons/gdharness_runtime/runtime_typing.gd +20 -20
  41. package/build/godot/addons/gdharness_runtime/runtime_values.gd +52 -25
  42. package/build/godot/addons/gdharness_runtime/runtime_waits.gd +56 -50
  43. package/build/godot/addons/gdharness_runtime/serialisation.gd +49 -94
  44. package/build/godot/addons/gdharness_runtime/value_shapes.gd +118 -0
  45. package/build/godot/addons/gdharness_runtime/value_shapes.gd.uid +1 -0
  46. package/build/godot/operations/animation_reads.gd +7 -19
  47. package/build/godot/operations/audio_buses.gd +10 -10
  48. package/build/godot/operations/class_cache.gd +16 -16
  49. package/build/godot/operations/classdb_queries.gd +25 -15
  50. package/build/godot/operations/declared_values.gd +116 -0
  51. package/build/godot/operations/dependencies.gd +141 -33
  52. package/build/godot/operations/editor_tools.gd +12 -12
  53. package/build/godot/operations/export_presets.gd +14 -14
  54. package/build/godot/operations/file_reads.gd +65 -25
  55. package/build/godot/operations/file_walk.gd +34 -0
  56. package/build/godot/operations/gdscript_analysis.gd +27 -22
  57. package/build/godot/operations/gdscript_authoring.gd +122 -17
  58. package/build/godot/operations/godot_operations.gd +66 -63
  59. package/build/godot/operations/import_pipeline.gd +59 -20
  60. package/build/godot/operations/input_actions.gd +90 -18
  61. package/build/godot/operations/logger.gd +1 -1
  62. package/build/godot/operations/plugins.gd +8 -8
  63. package/build/godot/operations/project_config.gd +83 -20
  64. package/build/godot/operations/project_diagnostics.gd +36 -11
  65. package/build/godot/operations/property_values.gd +222 -59
  66. package/build/godot/operations/reading.gd +65 -0
  67. package/build/godot/operations/rename_checks.gd +3 -3
  68. package/build/godot/operations/resource_files.gd +9 -6
  69. package/build/godot/operations/script_check.gd +23 -7
  70. package/build/godot/operations/serialisation.gd +49 -94
  71. package/build/godot/operations/value_shapes.gd +118 -0
  72. package/package.json +1 -1
@@ -4,19 +4,19 @@ extends Node
4
4
  ## Animations and animation trees, edited in the open editor or, for a project no editor serves, by a
5
5
  ## headless engine.
6
6
 
7
- const AnimationReads = preload("../animation_reads.gd")
8
- const HeadlessCheck = preload("../headless_check.gd")
9
- const PropertyValues = preload("../property_values.gd")
10
- const Read = preload("../reading.gd")
11
- const SceneFile = preload("../scene_file.gd")
12
- const Serialisation = preload("../serialisation.gd")
7
+ const GdhAnimationReads = preload("../animation_reads.gd")
8
+ const GdhHeadlessCheck = preload("../headless_check.gd")
9
+ const GdhPropertyValues = preload("../property_values.gd")
10
+ const GdhRead = preload("../reading.gd")
11
+ const GdhSceneFile = preload("../scene_file.gd")
12
+ const GdhSerialisation = preload("../serialisation.gd")
13
13
 
14
14
  ## How far right of the rightmost state a new one goes in the editor's graph, wider than a state's
15
15
  ## box there.
16
16
  const STATE_SPACING: float = 200.0
17
17
 
18
18
  var _editor_plugin: EditorPlugin = null
19
- var _properties: PropertyValues = PropertyValues.new()
19
+ var _properties: GdhPropertyValues = GdhPropertyValues.new()
20
20
 
21
21
 
22
22
  func set_editor_plugin(plugin: EditorPlugin) -> void:
@@ -42,15 +42,13 @@ func _find_node(root: Node, path: String) -> Node:
42
42
  ## [param kind] the scene owns. Answers [scene, node, refusal]; the refusal is {} when both were
43
43
  ## found.
44
44
  func _open_at(scene_path: String, node_path: String, kind: String) -> Array:
45
- var scene: SceneFile = SceneFile.new()
45
+ var scene: GdhSceneFile = GdhSceneFile.new()
46
46
  var refused: Dictionary = scene.open(scene_path, true)
47
47
  if not refused.is_empty():
48
48
  return [scene, null, refused]
49
49
  var node: Node = _find_node(scene.root, node_path)
50
50
  if node == null or not node.is_class(kind):
51
- return [
52
- scene, null, scene.refuse(scene.not_found("%s not found at: %s" % [kind, node_path], node_path))
53
- ]
51
+ return [scene, null, _not_of_kind(scene, node, node_path, kind)]
54
52
  var foreign: String = scene.foreign(node)
55
53
  if not foreign.is_empty():
56
54
  return [scene, null, scene.refuse(foreign)]
@@ -60,21 +58,34 @@ func _open_at(scene_path: String, node_path: String, kind: String) -> Array:
60
58
  ## [param scene_path] opened for reading, as [method _open_at] answers. A node an instanced scene
61
59
  ## owns is read like any other, since nothing is written.
62
60
  func _read_at(scene_path: String, node_path: String, kind: String) -> Array:
63
- var scene: SceneFile = SceneFile.new()
61
+ var scene: GdhSceneFile = GdhSceneFile.new()
64
62
  var refused: Dictionary = scene.open(scene_path, false)
65
63
  if not refused.is_empty():
66
64
  return [scene, null, refused]
67
65
  var node: Node = _find_node(scene.root, node_path)
68
66
  if node == null or not node.is_class(kind):
69
- return [
70
- scene, null, scene.refuse(scene.not_found("%s not found at: %s" % [kind, node_path], node_path))
71
- ]
67
+ return [scene, null, _not_of_kind(scene, node, node_path, kind)]
72
68
  return [scene, node, {}]
73
69
 
74
70
 
71
+ ## The refusal for [param node_path] in [param scene], where [param node] is what the scene has
72
+ ## there, null or not a [param kind], with where the scene's nodes of that kind are.
73
+ func _not_of_kind(scene: GdhSceneFile, node: Node, node_path: String, kind: String) -> Dictionary:
74
+ var said: String = "%s not found at: %s" % [kind, node_path]
75
+ if node == null:
76
+ said = scene.not_found(said, node_path)
77
+ var held: PackedStringArray = []
78
+ if scene.root.is_class(kind):
79
+ var _root_held: bool = held.append(".")
80
+ for found: Node in scene.root.find_children("*", kind, true, false):
81
+ var _held: bool = held.append(str(scene.root.get_path_to(found)))
82
+ var there: String = "" if node == null else node.get_class()
83
+ return scene.refuse(GdhRead.not_of_kind(said, node_path, there, kind, held))
84
+
85
+
75
86
  ## Writes [param scene] once [param check] passes, then the files of [param homes], answering
76
87
  ## [param answer] or a refusal.
77
- func _finish(scene: SceneFile, check: Callable, homes: Dictionary, answer: Dictionary) -> Dictionary:
88
+ func _finish(scene: GdhSceneFile, check: Callable, homes: Dictionary, answer: Dictionary) -> Dictionary:
78
89
  if not Engine.is_editor_hint():
79
90
  for file: Variant in homes:
80
91
  var home: Resource = homes[file]
@@ -91,7 +102,7 @@ func _finish(scene: SceneFile, check: Callable, homes: Dictionary, answer: Dicti
91
102
  )
92
103
  % file
93
104
  )
94
- + HeadlessCheck.REMEDY
105
+ + GdhHeadlessCheck.REMEDY
95
106
  )
96
107
  )
97
108
  )
@@ -100,7 +111,7 @@ func _finish(scene: SceneFile, check: Callable, homes: Dictionary, answer: Dicti
100
111
  return written
101
112
  for file: Variant in homes:
102
113
  var resource: Resource = homes[file]
103
- var saving: Error = SceneFile.save_keeping_uid(resource, str(file))
114
+ var saving: Error = GdhSceneFile.save_keeping_uid(resource, str(file))
104
115
  if saving != OK:
105
116
  return {"ok": false, "error": "Failed to save %s: %s" % [file, error_string(saving)]}
106
117
  if Engine.is_editor_hint():
@@ -112,14 +123,14 @@ func _finish(scene: SceneFile, check: Callable, homes: Dictionary, answer: Dicti
112
123
  ## engine ran as it loaded the file.
113
124
  func _scripted(resource: Resource) -> bool:
114
125
  var script: Script = resource.get_script()
115
- return (script != null and not script.is_tool()) or HeadlessCheck.holds_scripted_embedded(resource, {})
126
+ return (script != null and not script.is_tool()) or GdhHeadlessCheck.holds_scripted_embedded(resource, {})
116
127
 
117
128
 
118
129
  func _parse_json_maybe(value: Variant) -> Variant:
119
130
  if typeof(value) != TYPE_STRING:
120
131
  return value
121
132
  var text: String = value
122
- var parsed: Variant = Read.json_or_null(text)
133
+ var parsed: Variant = GdhRead.json_or_null(text)
123
134
  if parsed == null and text != "null":
124
135
  return value
125
136
  return parsed
@@ -140,7 +151,7 @@ func _parse_method_args(raw_args: Array) -> Array:
140
151
  ## edited in memory while only the scene was saved, which refers to the file, so the edit was
141
152
  ## answered as made and was gone; it is saved too. One inside some other file (an imported model,
142
153
  ## the scene this one inherits from) is refused, since nothing written here would keep the edit.
143
- func _homes(scene: SceneFile, held: Array) -> Array:
154
+ func _homes(scene: GdhSceneFile, held: Array) -> Array:
144
155
  var homes: Dictionary = {}
145
156
  for entry: Array in held:
146
157
  var resource: Resource = entry[0]
@@ -195,10 +206,10 @@ func _library_of(player: AnimationPlayer, animation_name: String) -> AnimationLi
195
206
 
196
207
  ## The state machine at [param state_machine_path] in [param anim_tree], with the files it is kept
197
208
  ## in, as [machine, homes, why not].
198
- func _machine(scene: SceneFile, anim_tree: AnimationTree, state_machine_path: String) -> Array:
199
- var sm: AnimationNodeStateMachine = AnimationReads.state_machine(anim_tree, state_machine_path)
209
+ func _machine(scene: GdhSceneFile, anim_tree: AnimationTree, state_machine_path: String) -> Array:
210
+ var sm: AnimationNodeStateMachine = GdhAnimationReads.state_machine(anim_tree, state_machine_path)
200
211
  if not sm:
201
- return [null, {}, AnimationReads.no_machine(anim_tree, state_machine_path)]
212
+ return [null, {}, GdhAnimationReads.no_machine(anim_tree, state_machine_path)]
202
213
  var homes: Array = _homes(scene, [[sm, "state machine"]])
203
214
  if not homes[0]:
204
215
  return [null, {}, homes[1]]
@@ -226,18 +237,18 @@ func read_animations(args: Dictionary) -> Dictionary:
226
237
  return {"ok": false, "error": "Missing scenePath"}
227
238
 
228
239
  var opened: Array = _read_at(scene_path, player_node_path, "AnimationPlayer")
229
- var scene: SceneFile = opened[0]
240
+ var scene: GdhSceneFile = opened[0]
230
241
  if opened[1] == null:
231
242
  return opened[2]
232
243
  var player: AnimationPlayer = opened[1]
233
- return _read_in(scene, AnimationReads.animations(player, animation_name))
244
+ return _read_in(scene, GdhAnimationReads.animations(player, animation_name))
234
245
 
235
246
 
236
247
  ## [param answer] read from [param scene], with whether the editor holds the scene unsaved.
237
- func _read_in(scene: SceneFile, answer: Dictionary) -> Dictionary:
248
+ func _read_in(scene: GdhSceneFile, answer: Dictionary) -> Dictionary:
238
249
  if not answer.get("ok", false):
239
250
  return scene.refuse(str(answer.get("error", "")))
240
- answer["unsavedInEditor"] = SceneFile.unsaved(scene.path)
251
+ answer["unsavedInEditor"] = GdhSceneFile.unsaved(scene.path)
241
252
  scene.close()
242
253
  return answer
243
254
 
@@ -253,11 +264,11 @@ func read_animation_states(args: Dictionary) -> Dictionary:
253
264
  return {"ok": false, "error": "Missing animTreePath"}
254
265
 
255
266
  var opened: Array = _read_at(scene_path, anim_tree_path, "AnimationTree")
256
- var scene: SceneFile = opened[0]
267
+ var scene: GdhSceneFile = opened[0]
257
268
  if opened[1] == null:
258
269
  return opened[2]
259
270
  var anim_tree: AnimationTree = opened[1]
260
- return _read_in(scene, AnimationReads.states(anim_tree, state_machine_path))
271
+ return _read_in(scene, GdhAnimationReads.states(anim_tree, state_machine_path))
261
272
 
262
273
 
263
274
  # =============================================================================
@@ -280,7 +291,7 @@ func create_animation(args: Dictionary) -> Dictionary:
280
291
  return {"ok": false, "error": "Unsupported loopMode: " + loop_mode_name}
281
292
 
282
293
  var opened: Array = _open_at(scene_path, player_node_path, "AnimationPlayer")
283
- var scene: SceneFile = opened[0]
294
+ var scene: GdhSceneFile = opened[0]
284
295
  if opened[1] == null:
285
296
  return opened[2]
286
297
  var player: AnimationPlayer = opened[1]
@@ -295,9 +306,9 @@ func create_animation(args: Dictionary) -> Dictionary:
295
306
  return scene.refuse(str(homes[1]))
296
307
 
297
308
  var anim: Animation = Animation.new()
298
- anim.length = Read.as_float(args.get("length", 1.0), 1.0)
299
- anim.loop_mode = Read.as_int(loop_modes[loop_mode_name]) as Animation.LoopMode
300
- anim.step = Read.as_float(args.get("step", 0.1), 0.1)
309
+ anim.length = GdhRead.as_float(args.get("length", 1.0), 1.0)
310
+ anim.loop_mode = GdhRead.as_int(loop_modes[loop_mode_name]) as Animation.LoopMode
311
+ anim.step = GdhRead.as_float(args.get("step", 0.1), 0.1)
301
312
  var called: String = animation_name.get_slice("/", 1) if animation_name.contains("/") else animation_name
302
313
  var add_err: Error = anim_lib.add_animation(StringName(called), anim)
303
314
  if add_err != OK:
@@ -337,7 +348,7 @@ func add_animation_track(args: Dictionary) -> Dictionary:
337
348
  return {"ok": false, "error": keyed[1]}
338
349
 
339
350
  var opened: Array = _open_at(scene_path, player_node_path, "AnimationPlayer")
340
- var scene: SceneFile = opened[0]
351
+ var scene: GdhSceneFile = opened[0]
341
352
  if opened[1] == null:
342
353
  return opened[2]
343
354
  var player: AnimationPlayer = opened[1]
@@ -429,7 +440,7 @@ func _add_track(
429
440
 
430
441
  for index: int in keyframes.size():
431
442
  var keyframe: Dictionary = keyframes[index]
432
- if anim.track_insert_key(track_idx, Read.as_float(keyframe["time"]), keys[index]) < 0:
443
+ if anim.track_insert_key(track_idx, GdhRead.as_float(keyframe["time"]), keys[index]) < 0:
433
444
  return [-1, "Keyframe %d could not be inserted." % index, null]
434
445
  return [track_idx, "", method_found]
435
446
 
@@ -450,7 +461,7 @@ func _keyframes(track: Dictionary) -> Array:
450
461
  var time: Variant = keyframe.get("time")
451
462
  if not (time is float or time is int):
452
463
  return [false, "keyframes[%d] has no time." % index]
453
- var seconds: float = Read.as_float(time)
464
+ var seconds: float = GdhRead.as_float(time)
454
465
  if times.has(seconds):
455
466
  return [
456
467
  false, "keyframes[%d] and [%d] are both at %s seconds." % [times[seconds], index, seconds]
@@ -504,7 +515,7 @@ func add_animation_state(args: Dictionary) -> Dictionary:
504
515
  return {"ok": false, "error": "Missing " + str(required[1])}
505
516
 
506
517
  var opened: Array = _open_at(scene_path, anim_tree_path, "AnimationTree")
507
- var scene: SceneFile = opened[0]
518
+ var scene: GdhSceneFile = opened[0]
508
519
  if opened[1] == null:
509
520
  return opened[2]
510
521
  var anim_tree: AnimationTree = opened[1]
@@ -547,7 +558,7 @@ func add_animation_state(args: Dictionary) -> Dictionary:
547
558
  "animationName": animation_name,
548
559
  # False when the tree has no player to look the animation up in.
549
560
  "animationFound": player != null,
550
- "position": Serialisation.new().serialize_value(position),
561
+ "position": GdhSerialisation.new().serialize_value(position),
551
562
  }
552
563
  var files: Dictionary = machine[1]
553
564
  return _finish(scene, Callable(), files, answer)
@@ -580,13 +591,13 @@ func connect_animation_states(args: Dictionary) -> Dictionary:
580
591
  return {"ok": false, "error": "Unsupported transitionType: " + transition_type}
581
592
  var transition: AnimationNodeStateMachineTransition = AnimationNodeStateMachineTransition.new()
582
593
  transition.switch_mode = (
583
- Read.as_int(modes[transition_type]) as AnimationNodeStateMachineTransition.SwitchMode
594
+ GdhRead.as_int(modes[transition_type]) as AnimationNodeStateMachineTransition.SwitchMode
584
595
  )
585
596
  if not advance_condition.is_empty():
586
597
  transition.advance_condition = StringName(advance_condition)
587
598
 
588
599
  var opened: Array = _open_at(scene_path, anim_tree_path, "AnimationTree")
589
- var scene: SceneFile = opened[0]
600
+ var scene: GdhSceneFile = opened[0]
590
601
  if opened[1] == null:
591
602
  return opened[2]
592
603
  var anim_tree: AnimationTree = opened[1]
@@ -4,8 +4,8 @@ extends Node
4
4
  ## The editor's view of the files on disk: scans, the reimports asked for, where each stands, and
5
5
  ## files moved under it.
6
6
 
7
- const Read = preload("../reading.gd")
8
- const SceneFile = preload("../scene_file.gd")
7
+ const GdhRead = preload("../reading.gd")
8
+ const GdhSceneFile = preload("../scene_file.gd")
9
9
 
10
10
  var _editor_plugin: EditorPlugin = null
11
11
 
@@ -63,7 +63,7 @@ func rescan_filesystem(args: Dictionary) -> Dictionary:
63
63
  var started: bool = false
64
64
  var completed_before: int = _scans_completed
65
65
  var uids: Dictionary = {"reread": [], "duplicated": []}
66
- if not Read.as_bool(args.get("statusOnly", false)) and not busy:
66
+ if not GdhRead.as_bool(args.get("statusOnly", false)) and not busy:
67
67
  uids = _reread_changed_uids(filesystem)
68
68
  # Files the caller has just written, moved or deleted, read again one by one. The scan finds a
69
69
  # script that appeared and leaves the global class of one that has gone in the editor's list,
@@ -172,7 +172,7 @@ func scan_status(_args: Dictionary) -> Dictionary:
172
172
  "ok": true,
173
173
  "scanning": filesystem.is_scanning(),
174
174
  "importing": filesystem.is_importing(),
175
- "pending": SceneFile.scan_due,
175
+ "pending": GdhSceneFile.scan_due,
176
176
  "sinceScanFinishedMs":
177
177
  -1 if _scan_finished_at_msec < 0 else Time.get_ticks_msec() - _scan_finished_at_msec,
178
178
  "reimportsCompleted": _reimports_completed,
@@ -9,7 +9,7 @@ extends Node
9
9
  ## tools answer at all.
10
10
 
11
11
  ## What the display server calls itself when the engine was started with no display at all.
12
- const Read = preload("../reading.gd")
12
+ const GdhRead = preload("../reading.gd")
13
13
 
14
14
  const HEADLESS_DISPLAY: String = "headless"
15
15
  ## Where Godot keeps the port its own debugger listens on for a game it is playing. One setting
@@ -245,7 +245,7 @@ func playing_status(_args: Dictionary) -> Dictionary:
245
245
  # play, so the one from when this editor greeted the server is a number it has moved off.
246
246
  var settings: EditorSettings = EditorInterface.get_editor_settings()
247
247
  var debugger: int = (
248
- Read.as_int(settings.get_setting(DEBUGGER_SETTING))
248
+ GdhRead.as_int(settings.get_setting(DEBUGGER_SETTING))
249
249
  if settings != null and settings.has_setting(DEBUGGER_SETTING)
250
250
  else 0
251
251
  )
@@ -10,7 +10,7 @@ extends Node
10
10
  ## `debug_data` signal every ScriptEditorDebugger emits for every message, on a node Godot does not
11
11
  ## expose to scripts: found by its class in the editor's tree and connected to by name.
12
12
 
13
- const Read = preload("../reading.gd")
13
+ const GdhRead = preload("../reading.gd")
14
14
 
15
15
  ## The most functions a frame may carry when the server does not say. The engine names a function
16
16
  ## once, as it first appears, and the game's debugger queue drops those messages past its size, so
@@ -28,7 +28,7 @@ const PROFILE_FROM_START: String = "GDHARNESS_PROFILE_FROM_START"
28
28
 
29
29
 
30
30
  ## The editor's debugger sessions, numbered as the editor numbers its debugger tabs.
31
- class Sessions:
31
+ class GdhSessions:
32
32
  extends EditorDebuggerPlugin
33
33
 
34
34
  signal session_started(session_id: int)
@@ -53,7 +53,7 @@ class Sessions:
53
53
 
54
54
 
55
55
  var _editor_plugin: EditorPlugin = null
56
- var _sessions: Sessions = null
56
+ var _sessions: GdhSessions = null
57
57
  ## The debugger tabs connected to, by instance id, so none is connected twice.
58
58
  var _hooked: Dictionary[int, bool] = {}
59
59
 
@@ -75,7 +75,7 @@ var _totals: Dictionary[String, PackedFloat64Array] = {}
75
75
 
76
76
  func set_editor_plugin(plugin: EditorPlugin) -> void:
77
77
  _editor_plugin = plugin
78
- _sessions = Sessions.new()
78
+ _sessions = GdhSessions.new()
79
79
  var joined: int = _sessions.session_started.connect(_on_session_started)
80
80
  if joined != OK:
81
81
  push_error("gdharness could not watch debugger sessions start: %d" % joined)
@@ -105,9 +105,9 @@ func profile_start(args: Dictionary) -> Dictionary:
105
105
  ),
106
106
  }
107
107
  _reset()
108
- var asked: int = Read.as_int(args.get("frameFunctions", FRAME_FUNCTIONS))
108
+ var asked: int = GdhRead.as_int(args.get("frameFunctions", FRAME_FUNCTIONS))
109
109
  _frame_functions = asked if asked > 0 else FRAME_FUNCTIONS
110
- if Read.as_bool(args.get("arm", false)):
110
+ if GdhRead.as_bool(args.get("arm", false)):
111
111
  _armed = true
112
112
  # The game the editor starts next inherits the editor's environment, and this tells its
113
113
  # runtime addon to hold its start until the profiler is on, which the session's start
@@ -206,7 +206,7 @@ func _on_debug_data(message: String, data: Array, session_id: int) -> void:
206
206
  if session_id != _session:
207
207
  return
208
208
  if message == "servers:function_signature" and data.size() >= 2:
209
- _names[Read.as_int(data[1])] = str(data[0])
209
+ _names[GdhRead.as_int(data[1])] = str(data[0])
210
210
  elif message == "servers:profile_frame":
211
211
  var carried: int = _add(data, _totals)
212
212
  if carried >= 0:
@@ -231,28 +231,28 @@ func _add(data: Array, into: Dictionary[String, PackedFloat64Array]) -> int:
231
231
  var at: int = 6
232
232
  if data.size() <= at:
233
233
  return -1
234
- var servers: int = Read.as_int(data[at])
234
+ var servers: int = GdhRead.as_int(data[at])
235
235
  at += 1
236
236
  for _server: int in servers:
237
237
  if data.size() <= at + 1:
238
238
  return -1
239
- at += 2 + Read.as_int(data[at + 1])
239
+ at += 2 + GdhRead.as_int(data[at + 1])
240
240
  if data.size() <= at:
241
241
  return -1
242
- var values: int = Read.as_int(data[at])
242
+ var values: int = GdhRead.as_int(data[at])
243
243
  at += 1
244
244
  if values % 5 != 0 or data.size() < at + values:
245
245
  return -1
246
246
  var carried: int = 0
247
247
  for index: int in range(at, at + values, 5):
248
- var id: int = Read.as_int(data[index])
248
+ var id: int = GdhRead.as_int(data[index])
249
249
  var signature: String = _names[id] if _names.has(id) else "#%d" % id
250
250
  var sum: PackedFloat64Array = (
251
251
  into[signature] if into.has(signature) else PackedFloat64Array([0, 0, 0])
252
252
  )
253
- sum[0] += Read.as_float(data[index + 1])
254
- sum[1] += Read.as_float(data[index + 2])
255
- sum[2] += Read.as_float(data[index + 3])
253
+ sum[0] += GdhRead.as_float(data[index + 1])
254
+ sum[1] += GdhRead.as_float(data[index + 2])
255
+ sum[2] += GdhRead.as_float(data[index + 3])
256
256
  into[signature] = sum
257
257
  carried += 1
258
258
  return carried