gdharness 1.3.41 → 1.3.43

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 (107) hide show
  1. package/build/cli.js +131 -47
  2. package/build/godot/addons/auto_reload/auto_reload.gd +18 -19
  3. package/build/godot/addons/gdharness_editor/animation_reads.gd +84 -35
  4. package/build/godot/addons/gdharness_editor/bridge_client.gd +53 -58
  5. package/build/godot/addons/gdharness_editor/declared_values.gd +68 -32
  6. package/build/godot/addons/gdharness_editor/file_reads.gd +114 -39
  7. package/build/godot/addons/gdharness_editor/file_walk.gd +12 -5
  8. package/build/godot/addons/gdharness_editor/headless_check.gd +94 -41
  9. package/build/godot/addons/gdharness_editor/plugin.gd +2 -3
  10. package/build/godot/addons/gdharness_editor/property_paths.gd +22 -12
  11. package/build/godot/addons/gdharness_editor/property_values.gd +143 -78
  12. package/build/godot/addons/gdharness_editor/reading.gd +37 -12
  13. package/build/godot/addons/gdharness_editor/same_values.gd +4 -4
  14. package/build/godot/addons/gdharness_editor/scene_file.gd +136 -79
  15. package/build/godot/addons/gdharness_editor/scene_uids.gd +12 -6
  16. package/build/godot/addons/gdharness_editor/serialisation.gd +75 -51
  17. package/build/godot/addons/gdharness_editor/setting_reads.gd +7 -6
  18. package/build/godot/addons/gdharness_editor/tool_executor.gd +3 -6
  19. package/build/godot/addons/gdharness_editor/tools/animation_states.gd +41 -28
  20. package/build/godot/addons/gdharness_editor/tools/animation_tools.gd +84 -50
  21. package/build/godot/addons/gdharness_editor/tools/animation_tracks.gd +70 -40
  22. package/build/godot/addons/gdharness_editor/tools/class_tools.gd +34 -30
  23. package/build/godot/addons/gdharness_editor/tools/filesystem_tools.gd +24 -22
  24. package/build/godot/addons/gdharness_editor/tools/navigation_bake.gd +49 -29
  25. package/build/godot/addons/gdharness_editor/tools/play_tools.gd +26 -21
  26. package/build/godot/addons/gdharness_editor/tools/profile_tools.gd +40 -40
  27. package/build/godot/addons/gdharness_editor/tools/resource_tools.gd +181 -107
  28. package/build/godot/addons/gdharness_editor/tools/scene_groups.gd +16 -9
  29. package/build/godot/addons/gdharness_editor/tools/scene_kin.gd +75 -43
  30. package/build/godot/addons/gdharness_editor/tools/scene_paths.gd +35 -20
  31. package/build/godot/addons/gdharness_editor/tools/scene_placing.gd +28 -13
  32. package/build/godot/addons/gdharness_editor/tools/scene_sharing.gd +66 -0
  33. package/build/godot/addons/gdharness_editor/tools/scene_sharing.gd.uid +1 -0
  34. package/build/godot/addons/gdharness_editor/tools/scene_tools.gd +171 -62
  35. package/build/godot/addons/gdharness_editor/tools/script_paths.gd +20 -8
  36. package/build/godot/addons/gdharness_editor/tools/settings_tools.gd +11 -8
  37. package/build/godot/addons/gdharness_editor/tools/signal_tools.gd +47 -34
  38. package/build/godot/addons/gdharness_editor/tools/tileset_tools.gd +77 -50
  39. package/build/godot/addons/gdharness_editor/value_shapes.gd +5 -6
  40. package/build/godot/addons/gdharness_runtime/call_errors.gd +1 -2
  41. package/build/godot/addons/gdharness_runtime/declared_values.gd +68 -32
  42. package/build/godot/addons/gdharness_runtime/error_report.gd +1 -2
  43. package/build/godot/addons/gdharness_runtime/reading.gd +37 -12
  44. package/build/godot/addons/gdharness_runtime/runtime_accessibility.gd +84 -63
  45. package/build/godot/addons/gdharness_runtime/runtime_autoload.gd +153 -148
  46. package/build/godot/addons/gdharness_runtime/runtime_capture.gd +64 -42
  47. package/build/godot/addons/gdharness_runtime/runtime_changes.gd +184 -122
  48. package/build/godot/addons/gdharness_runtime/runtime_frames.gd +2 -2
  49. package/build/godot/addons/gdharness_runtime/runtime_hover.gd +24 -20
  50. package/build/godot/addons/gdharness_runtime/runtime_input.gd +134 -92
  51. package/build/godot/addons/gdharness_runtime/runtime_items.gd +29 -13
  52. package/build/godot/addons/gdharness_runtime/runtime_menus.gd +0 -1
  53. package/build/godot/addons/gdharness_runtime/runtime_mouse.gd +38 -20
  54. package/build/godot/addons/gdharness_runtime/runtime_pad.gd +17 -13
  55. package/build/godot/addons/gdharness_runtime/runtime_paths.gd +84 -46
  56. package/build/godot/addons/gdharness_runtime/runtime_queries.gd +117 -79
  57. package/build/godot/addons/gdharness_runtime/runtime_says.gd +14 -17
  58. package/build/godot/addons/gdharness_runtime/runtime_screen.gd +23 -16
  59. package/build/godot/addons/gdharness_runtime/runtime_targets.gd +117 -66
  60. package/build/godot/addons/gdharness_runtime/runtime_touch.gd +211 -0
  61. package/build/godot/addons/gdharness_runtime/runtime_touch.gd.uid +1 -0
  62. package/build/godot/addons/gdharness_runtime/runtime_typing.gd +44 -27
  63. package/build/godot/addons/gdharness_runtime/runtime_values.gd +108 -73
  64. package/build/godot/addons/gdharness_runtime/runtime_waits.gd +111 -84
  65. package/build/godot/addons/gdharness_runtime/runtime_words.gd +10 -7
  66. package/build/godot/addons/gdharness_runtime/serialisation.gd +75 -51
  67. package/build/godot/addons/gdharness_runtime/value_shapes.gd +5 -6
  68. package/build/godot/addons/gdharness_tests/bench.gd +4 -5
  69. package/build/godot/addons/gdharness_tests/event.gd +10 -5
  70. package/build/godot/addons/gdharness_tests/share.gd +38 -18
  71. package/build/godot/addons/gdharness_tests/suites.gd +3 -3
  72. package/build/godot/addons/gdharness_tests/wait.gd +3 -2
  73. package/build/godot/loader/loader.gd +9 -9
  74. package/build/godot/operations/animation_reads.gd +84 -35
  75. package/build/godot/operations/audio_buses.gd +48 -19
  76. package/build/godot/operations/class_cache.gd +16 -11
  77. package/build/godot/operations/classdb_queries.gd +89 -44
  78. package/build/godot/operations/declared_values.gd +68 -32
  79. package/build/godot/operations/dependencies.gd +139 -93
  80. package/build/godot/operations/editor_tools.gd +9 -10
  81. package/build/godot/operations/export_presets.gd +100 -54
  82. package/build/godot/operations/file_reads.gd +114 -39
  83. package/build/godot/operations/file_walk.gd +12 -5
  84. package/build/godot/operations/gdscript_analysis.gd +105 -66
  85. package/build/godot/operations/gdscript_authoring.gd +138 -39
  86. package/build/godot/operations/godot_operations.gd +17 -11
  87. package/build/godot/operations/import_pipeline.gd +110 -59
  88. package/build/godot/operations/input_actions.gd +63 -39
  89. package/build/godot/operations/patterns.gd +3 -1
  90. package/build/godot/operations/plugins.gd +36 -16
  91. package/build/godot/operations/project_config.gd +144 -27
  92. package/build/godot/operations/project_diagnostics.gd +24 -11
  93. package/build/godot/operations/project_file.gd +16 -16
  94. package/build/godot/operations/project_validation.gd +71 -44
  95. package/build/godot/operations/property_paths.gd +22 -12
  96. package/build/godot/operations/property_values.gd +143 -78
  97. package/build/godot/operations/reading.gd +37 -12
  98. package/build/godot/operations/rename_checks.gd +2 -2
  99. package/build/godot/operations/resource_files.gd +11 -9
  100. package/build/godot/operations/same_values.gd +4 -4
  101. package/build/godot/operations/scene_connections.gd +27 -13
  102. package/build/godot/operations/script_check.gd +52 -49
  103. package/build/godot/operations/serialisation.gd +75 -51
  104. package/build/godot/operations/setting_reads.gd +7 -6
  105. package/build/godot/operations/value_shapes.gd +5 -6
  106. package/build/godot/tests/listed.gd +321 -268
  107. package/package.json +1 -1
@@ -1,10 +1,8 @@
1
1
  extends RefCounted
2
-
3
2
  ## export_presets.cfg, read and written in the format the editor's Project > Export saves it in.
4
3
 
5
4
  const GdhRead = preload("reading.gd")
6
5
  const GdhLog = preload("logger.gd")
7
-
8
6
  const PRESETS_FILE: String = "res://export_presets.cfg"
9
7
  ## Where the editor names the one preset of each platform it runs on a device.
10
8
  const RUNNABLE_SECTION: String = "runnable_presets"
@@ -18,8 +16,8 @@ const PLATFORMS: Dictionary[String, String] = {
18
16
  "iOS": "ios",
19
17
  "Web": "web_",
20
18
  }
21
-
22
- ## Each platform's exporter, which only an editor can make: the options a preset of it takes are its.
19
+ ## Each platform's exporter, which only an editor can make: the options a preset of it takes are
20
+ ## its.
23
21
  const EXPORTERS: Dictionary[String, String] = {
24
22
  "Windows Desktop": "EditorExportPlatformWindows",
25
23
  "Linux": "EditorExportPlatformLinuxBSD",
@@ -29,7 +27,8 @@ const EXPORTERS: Dictionary[String, String] = {
29
27
  "Web": "EditorExportPlatformWeb",
30
28
  }
31
29
  ## What export_filter takes, as the Export dialog's Resources tab names them: everything, the scenes
32
- ## listed under export_files and what they use, the resources listed, or everything but those listed.
30
+ ## listed under export_files and what they use, the resources listed, or everything but those
31
+ ## listed.
33
32
  const FILTERS: Array[String] = ["all_resources", "scenes", "resources", "exclude"]
34
33
  ## Where the editor keeps a preset's secret options, such as a signing password, out of
35
34
  ## export_presets.cfg, which a project commits.
@@ -38,7 +37,9 @@ const CREDENTIALS_FILE: String = "res://.godot/export_credentials.cfg"
38
37
  ## a switch no script can reach.
39
38
  const TEMPLATE_OPTIONS: Array[String] = ["custom_template/debug", "custom_template/release"]
40
39
  ## The types of option a value is written for. An option of another type is left to the editor.
41
- const WRITABLE: Array[int] = [TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_PACKED_STRING_ARRAY]
40
+ const WRITABLE: Array[int] = [
41
+ TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_PACKED_STRING_ARRAY,
42
+ ]
42
43
 
43
44
  var _log: GdhLog
44
45
 
@@ -67,9 +68,9 @@ func list_export_presets(_params: Dictionary) -> Dictionary:
67
68
  "presets_file_exists": false,
68
69
  "note":
69
70
  (
70
- "No export_presets.cfg found. project_export add_preset adds a preset, as the editor's "
71
- + "Project > Export does."
72
- )
71
+ "No export_presets.cfg found. project_export add_preset adds a preset, as the "
72
+ + "editor's Project > Export does."
73
+ ),
73
74
  }
74
75
  var config: ConfigFile = ConfigFile.new()
75
76
  var err: Error = config.load(PRESETS_FILE)
@@ -90,7 +91,7 @@ func list_export_presets(_params: Dictionary) -> Dictionary:
90
91
  "export_path": config.get_value(section, "export_path", ""),
91
92
  "export_filter": config.get_value(section, "export_filter", "all_resources"),
92
93
  "include_filter": config.get_value(section, "include_filter", ""),
93
- "exclude_filter": config.get_value(section, "exclude_filter", "")
94
+ "exclude_filter": config.get_value(section, "exclude_filter", ""),
94
95
  }
95
96
  if config.has_section_key(section, "custom_features"):
96
97
  preset["custom_features"] = config.get_value(section, "custom_features", "")
@@ -100,7 +101,12 @@ func list_export_presets(_params: Dictionary) -> Dictionary:
100
101
  preset["templates_installed"] = _installed(templates, platform)
101
102
  presets.append(preset)
102
103
  index += 1
103
- return {"presets": presets, "presets_file_exists": true, "total_presets": index, "templates": templates}
104
+ return {
105
+ "presets": presets,
106
+ "presets_file_exists": true,
107
+ "total_presets": index,
108
+ "templates": templates,
109
+ }
104
110
 
105
111
 
106
112
  ## Whether the preset in [param section] is the one its platform runs. The editor names that preset
@@ -108,7 +114,10 @@ func list_export_presets(_params: Dictionary) -> Dictionary:
108
114
  static func _runnable(config: ConfigFile, section: String) -> bool:
109
115
  var platform: String = str(config.get_value(section, "platform", ""))
110
116
  if config.has_section_key(RUNNABLE_SECTION, platform):
111
- return str(config.get_value(RUNNABLE_SECTION, platform)) == str(config.get_value(section, "name", ""))
117
+ return (
118
+ str(config.get_value(RUNNABLE_SECTION, platform))
119
+ == str(config.get_value(section, "name", ""))
120
+ )
112
121
  return GdhRead.as_bool(config.get_value(section, "runnable", false))
113
122
 
114
123
 
@@ -137,7 +146,9 @@ func add_export_preset(params: Dictionary) -> Dictionary:
137
146
  var held: String = "preset." + str(index)
138
147
  if str(config.get_value(held, "name", "")) == preset_name:
139
148
  var path: String = str(config.get_value(held, "export_path", ""))
140
- var to: String = "with no export path set" if path.is_empty() else "exporting to '%s'" % path
149
+ var to: String = (
150
+ "with no export path set" if path.is_empty() else "exporting to '%s'" % path
151
+ )
141
152
  return _log.failure(
142
153
  (
143
154
  (
@@ -209,9 +220,9 @@ func add_export_preset(params: Dictionary) -> Dictionary:
209
220
  if not installed:
210
221
  answer["templates_note"] = (
211
222
  (
212
- "No %s export templates for this engine are at %s, and an export for %s needs them. The "
213
- + "editor installs them in Editor > Manage Export Templates, or they can be unpacked "
214
- + "there from the export templates archive of this engine's release."
223
+ "No %s export templates for this engine are at %s, and an export for %s needs "
224
+ + "them. The editor installs them in Editor > Manage Export Templates, or they can "
225
+ + "be unpacked there from the export templates archive of this engine's release."
215
226
  )
216
227
  % [platform, templates, platform]
217
228
  )
@@ -232,8 +243,8 @@ static func _templates_dir() -> String:
232
243
  named += ".mono"
233
244
  var beside: String = OS.get_executable_path().get_base_dir()
234
245
  var contained: bool = _marks_self_contained(beside)
235
- # A macOS bundle is read-only, so its editor looks for the marker beside the bundle too, and keeps
236
- # its data there whichever of the two places had it.
246
+ # A macOS bundle is read-only, so its editor looks for the marker beside the bundle too, and
247
+ # keeps its data there whichever of the two places had it.
237
248
  if (
238
249
  OS.has_feature("macos")
239
250
  and beside.ends_with("MacOS")
@@ -323,8 +334,8 @@ func export_options(params: Dictionary) -> Dictionary:
323
334
  state.set(name, fitted)
324
335
  came = true
325
336
  listed = _options_shown(state, fresh)
326
- # Every asked option the preset would not list, including one an earlier round listed and a later
327
- # one hid, as turning codesign/enable off in the same call hides codesign/identity.
337
+ # Every asked option the preset would not list, including one an earlier round listed and a
338
+ # later one hid, as turning codesign/enable off in the same call hides codesign/identity.
328
339
  var hidden: Dictionary = {}
329
340
  for key: Variant in asked:
330
341
  if listed.has(str(key)):
@@ -332,7 +343,7 @@ func export_options(params: Dictionary) -> Dictionary:
332
343
  var shown_by: String = _shown_by(state, str(key), listed)
333
344
  if not shown_by.is_empty():
334
345
  hidden[str(key)] = shown_by
335
- return {"platform": platform, "options": listed.values(), "hidden": hidden}
346
+ return { "platform": platform, "options": listed.values(), "hidden": hidden }
336
347
 
337
348
 
338
349
  ## Which one change to a listed true-or-false or enum option of [param state] would list
@@ -348,7 +359,10 @@ static func _shown_by(state: Object, name: String, listed: Dictionary) -> String
348
359
  var choices: PackedStringArray = str(option["hintString"]).split(",", false)
349
360
  for at: int in choices.size():
350
361
  var label: String = choices[at].get_slice(":", 0)
351
- tries[int(choices[at].get_slice(":", 1)) if choices[at].contains(":") else at] = label
362
+ var number: int = at
363
+ if choices[at].contains(":"):
364
+ number = int(choices[at].get_slice(":", 1))
365
+ tries[number] = label
352
366
  for value: Variant in tries:
353
367
  if _same(value, held):
354
368
  continue
@@ -374,7 +388,11 @@ static func _options_shown(state: Object, fresh: Object) -> Dictionary:
374
388
  for property: Dictionary in state.get_property_list():
375
389
  var usage: int = GdhRead.as_int(property.get("usage", 0))
376
390
  var name: String = str(property.get("name", ""))
377
- if usage & PROPERTY_USAGE_CATEGORY or usage & PROPERTY_USAGE_GROUP or not name.contains("/"):
391
+ if (
392
+ usage & PROPERTY_USAGE_CATEGORY
393
+ or usage & PROPERTY_USAGE_GROUP
394
+ or not name.contains("/")
395
+ ):
378
396
  continue
379
397
  listed[name] = {
380
398
  "name": name,
@@ -423,7 +441,9 @@ func set_export_preset(params: Dictionary) -> Dictionary:
423
441
  )
424
442
  if params.has("export_filter"):
425
443
  if filter not in FILTERS:
426
- return _log.failure(GdhRead.offered("export_filter takes no %s" % filter, filter, FILTERS) + ".")
444
+ return _log.failure(
445
+ GdhRead.offered("export_filter takes no %s" % filter, filter, FILTERS) + "."
446
+ )
427
447
  top["export_filter"] = filter
428
448
  if params.has("files"):
429
449
  var listed: Variant = _files_for(filter, params["files"])
@@ -432,13 +452,18 @@ func set_export_preset(params: Dictionary) -> Dictionary:
432
452
  top["export_files"] = listed
433
453
  elif filter != "all_resources" and params.has("export_filter"):
434
454
  var kept: Variant = config.get_value(section, "export_files", PackedStringArray())
435
- var kept_files: PackedStringArray = kept if kept is PackedStringArray else PackedStringArray()
455
+ var kept_files: PackedStringArray = (
456
+ kept if kept is PackedStringArray else PackedStringArray()
457
+ )
436
458
  if kept is PackedStringArray and kept_files.is_empty():
437
459
  return (
438
460
  _log
439
461
  . failure(
440
462
  (
441
- "export_filter %s exports the files the preset lists, and it lists none: give them in files."
463
+ (
464
+ "export_filter %s exports the files the preset lists, and it lists "
465
+ + "none: give them in files."
466
+ )
442
467
  % filter
443
468
  )
444
469
  )
@@ -456,20 +481,25 @@ func set_export_preset(params: Dictionary) -> Dictionary:
456
481
  return _log.failure(str(written))
457
482
  var values: Dictionary = written
458
483
  if top.is_empty() and values.is_empty():
459
- return _log.failure(
460
- (
461
- "Nothing to change: give outputPath, exportFilter, files, includeFilter, excludeFilter, "
462
- + "customFeatures or options."
484
+ return (
485
+ _log
486
+ . failure(
487
+ (
488
+ "Nothing to change: give outputPath, exportFilter, files, includeFilter, "
489
+ + "excludeFilter, customFeatures or options."
490
+ )
463
491
  )
464
492
  )
465
493
  var changed: Dictionary = {}
466
494
  var unchanged: Array[String] = []
467
495
  for key: String in top:
468
- var before: Variant = config.get_value(section, key) if config.has_section_key(section, key) else null
496
+ var before: Variant = (
497
+ config.get_value(section, key) if config.has_section_key(section, key) else null
498
+ )
469
499
  if _same(before, top[key]):
470
500
  unchanged.append(key)
471
501
  continue
472
- changed[key] = {"before": before, "now": top[key]}
502
+ changed[key] = { "before": before, "now": top[key] }
473
503
  config.set_value(section, key, top[key])
474
504
  var described: Dictionary = {}
475
505
  if known is Array:
@@ -496,9 +526,9 @@ func set_export_preset(params: Dictionary) -> Dictionary:
496
526
  holder.set_value(section + ".options", name, values[name])
497
527
  if secret:
498
528
  secrets.append(name)
499
- changed[name] = {"secret": true}
529
+ changed[name] = { "secret": true }
500
530
  else:
501
- changed[name] = {"before": held, "now": values[name]}
531
+ changed[name] = { "before": held, "now": values[name] }
502
532
  var gone: String = _missing_path(values[name], option)
503
533
  if not gone.is_empty() and secret:
504
534
  missing_secrets.append(name)
@@ -583,7 +613,7 @@ func remove_export_preset(params: Dictionary) -> Dictionary:
583
613
  while config.has_section("preset." + str(last + 1)):
584
614
  last += 1
585
615
  _renumber(config, index, last)
586
- var answer: Dictionary = {"removed": preset_name, "platform": platform, "file": PRESETS_FILE}
616
+ var answer: Dictionary = { "removed": preset_name, "platform": platform, "file": PRESETS_FILE }
587
617
  # The secrets are kept by the same numbers, so left alone they would pass to the next preset.
588
618
  var credentials: ConfigFile = ConfigFile.new()
589
619
  if FileAccess.file_exists(CREDENTIALS_FILE) and credentials.load(CREDENTIALS_FILE) == OK:
@@ -640,16 +670,18 @@ static func _preset_named(preset_name: String) -> Variant:
640
670
  if index == -1:
641
671
  if held.is_empty():
642
672
  return "export_presets.cfg has no preset, so none called %s." % preset_name
643
- return GdhRead.offered("There is no export preset %s" % preset_name, preset_name, held) + "."
644
- return {"config": config, "section": "preset." + str(index), "index": index}
673
+ return (
674
+ GdhRead.offered("There is no export preset %s" % preset_name, preset_name, held) + "."
675
+ )
676
+ return { "config": config, "section": "preset." + str(index), "index": index }
645
677
 
646
678
 
647
679
  ## The files a preset exporting by [param filter] lists, from [param given], or why they are not.
648
680
  static func _files_for(filter: String, given: Variant) -> Variant:
649
681
  if filter == "all_resources":
650
682
  return (
651
- "files are what a preset exports when export_filter is scenes, resources or exclude, and "
652
- + "this one exports all_resources: give exportFilter too."
683
+ "files are what a preset exports when export_filter is scenes, resources or exclude, "
684
+ + "and this one exports all_resources: give exportFilter too."
653
685
  )
654
686
  if not given is Array:
655
687
  return "files is a list of res:// paths."
@@ -673,7 +705,10 @@ static func _files_for(filter: String, given: Variant) -> Variant:
673
705
  )
674
706
  if not not_scenes.is_empty():
675
707
  return (
676
- "Nothing was written: export_filter scenes lists scenes, and %s %s not one; resources lists any file."
708
+ (
709
+ "Nothing was written: export_filter scenes lists scenes, and %s %s not one; "
710
+ + "resources lists any file."
711
+ )
677
712
  % [", ".join(not_scenes), "is" if not_scenes.size() == 1 else "are"]
678
713
  )
679
714
  return listed
@@ -682,7 +717,9 @@ static func _files_for(filter: String, given: Variant) -> Variant:
682
717
  ## The values [param asked] gives [param platform]'s options, each fitted to the option's type in
683
718
  ## [param known], or why one is refused. [param hidden] says, for an option the preset has and does
684
719
  ## not list as it would stand, what would list it.
685
- static func _options_for(platform: String, asked: Dictionary, known: Variant, hidden: Dictionary) -> Variant:
720
+ static func _options_for(
721
+ platform: String, asked: Dictionary, known: Variant, hidden: Dictionary
722
+ ) -> Variant:
686
723
  var values: Dictionary = {}
687
724
  if asked.is_empty():
688
725
  return values
@@ -697,14 +734,17 @@ static func _options_for(platform: String, asked: Dictionary, known: Variant, hi
697
734
  if not by_name.has(name) and hidden.has(name):
698
735
  return (
699
736
  (
700
- "A %s preset lists %s only while %s, as the Export dialog shows it, and this one "
701
- + "would not: give %s in the same call, or set it first."
737
+ "A %s preset lists %s only while %s, as the Export dialog shows it, and this "
738
+ + "one would not: give %s in the same call, or set it first."
702
739
  )
703
740
  % [platform, name, hidden[name], str(hidden[name]).replace(" is ", " ")]
704
741
  )
705
742
  if not by_name.has(name):
706
743
  return (
707
- GdhRead.offered("A %s preset has no option %s" % [platform, name], name, by_name.keys()) + "."
744
+ GdhRead.offered(
745
+ "A %s preset has no option %s" % [platform, name], name, by_name.keys()
746
+ )
747
+ + "."
708
748
  )
709
749
  var option: Dictionary = by_name[name]
710
750
  var fitted: Variant = _fitted(name, asked[key], option)
@@ -762,7 +802,9 @@ static func missing_named(preset_name: String) -> Array[String]:
762
802
  if not holder.has_section(section + ".options"):
763
803
  continue
764
804
  for key: String in holder.get_section_keys(section + ".options"):
765
- var option: Dictionary = {"hint": PROPERTY_HINT_GLOBAL_FILE} if key in TEMPLATE_OPTIONS else {}
805
+ var option: Dictionary = (
806
+ { "hint": PROPERTY_HINT_GLOBAL_FILE } if key in TEMPLATE_OPTIONS else {}
807
+ )
766
808
  var gone: String = _missing_path(holder.get_value(section + ".options", key), option)
767
809
  if gone.is_empty():
768
810
  continue
@@ -792,19 +834,23 @@ static func _fitted(name: String, value: Variant, option: Dictionary) -> Variant
792
834
  (
793
835
  "%s is a %s, which this tool does not write; the editor's Export dialog does."
794
836
  % [name, type_string(type)]
795
- )
837
+ ),
796
838
  }
797
839
  if type == TYPE_BOOL:
798
- return value if value is bool else {"refused": "%s is true or false, not %s." % [name, shown]}
840
+ if value is bool:
841
+ return value
842
+ return { "refused": "%s is true or false, not %s." % [name, shown] }
799
843
  if type == TYPE_INT and hint == PROPERTY_HINT_ENUM:
800
844
  var named: PackedStringArray = []
801
845
  for at: int in choices.size():
802
846
  var choice: String = choices[at].get_slice(":", 0)
803
- var number: int = int(choices[at].get_slice(":", 1)) if choices[at].contains(":") else at
847
+ var number: int = (
848
+ int(choices[at].get_slice(":", 1)) if choices[at].contains(":") else at
849
+ )
804
850
  var _named: bool = named.append(choice)
805
851
  if str(value) == choice or ((value is int or value is float) and value == number):
806
852
  return number
807
- return {"refused": "%s is one of %s, not %s." % [name, ", ".join(named), shown]}
853
+ return { "refused": "%s is one of %s, not %s." % [name, ", ".join(named), shown] }
808
854
  if type == TYPE_INT:
809
855
  if value is int:
810
856
  return value
@@ -812,19 +858,19 @@ static func _fitted(name: String, value: Variant, option: Dictionary) -> Variant
812
858
  var whole: float = value
813
859
  if whole == floorf(whole):
814
860
  return int(whole)
815
- return {"refused": "%s is a whole number, not %s." % [name, shown]}
861
+ return { "refused": "%s is a whole number, not %s." % [name, shown] }
816
862
  if type == TYPE_FLOAT:
817
863
  if value is int or value is float:
818
864
  var amount: float = value
819
865
  return amount
820
- return {"refused": "%s is a number, not %s." % [name, shown]}
866
+ return { "refused": "%s is a number, not %s." % [name, shown] }
821
867
  if type == TYPE_STRING:
822
868
  if not value is String:
823
- return {"refused": "%s is text, not %s." % [name, shown]}
869
+ return { "refused": "%s is text, not %s." % [name, shown] }
824
870
  if hint == PROPERTY_HINT_ENUM and not choices.is_empty() and str(value) not in choices:
825
- return {"refused": "%s is one of %s, not %s." % [name, ", ".join(choices), shown]}
871
+ return { "refused": "%s is one of %s, not %s." % [name, ", ".join(choices), shown] }
826
872
  return value
827
873
  if not value is Array:
828
- return {"refused": "%s is a list of text, not %s." % [name, shown]}
874
+ return { "refused": "%s is a list of text, not %s." % [name, shown] }
829
875
  var items: Array = value
830
876
  return PackedStringArray(items)