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.
- package/build/cli.js +322 -96
- package/build/godot/addons/gdharness_editor/animation_reads.gd +7 -19
- package/build/godot/addons/gdharness_editor/bridge_client.gd +8 -8
- package/build/godot/addons/gdharness_editor/declared_values.gd +116 -0
- package/build/godot/addons/gdharness_editor/declared_values.gd.uid +1 -0
- package/build/godot/addons/gdharness_editor/file_reads.gd +65 -25
- package/build/godot/addons/gdharness_editor/headless_check.gd +7 -7
- package/build/godot/addons/gdharness_editor/plugin.gd +6 -6
- package/build/godot/addons/gdharness_editor/property_values.gd +222 -59
- package/build/godot/addons/gdharness_editor/reading.gd +65 -0
- package/build/godot/addons/gdharness_editor/scene_file.gd +28 -23
- package/build/godot/addons/gdharness_editor/serialisation.gd +49 -94
- package/build/godot/addons/gdharness_editor/tool_executor.gd +24 -24
- package/build/godot/addons/gdharness_editor/tools/animation_tools.gd +52 -41
- package/build/godot/addons/gdharness_editor/tools/filesystem_tools.gd +4 -4
- package/build/godot/addons/gdharness_editor/tools/play_tools.gd +2 -2
- package/build/godot/addons/gdharness_editor/tools/profile_tools.gd +14 -14
- package/build/godot/addons/gdharness_editor/tools/resource_tools.gd +175 -74
- package/build/godot/addons/gdharness_editor/tools/scene_kin.gd +17 -17
- package/build/godot/addons/gdharness_editor/tools/scene_paths.gd +14 -12
- package/build/godot/addons/gdharness_editor/tools/scene_placing.gd +7 -7
- package/build/godot/addons/gdharness_editor/tools/scene_tools.gd +88 -84
- package/build/godot/addons/gdharness_editor/tools/settings_tools.gd +4 -4
- package/build/godot/addons/gdharness_editor/value_shapes.gd +118 -0
- package/build/godot/addons/gdharness_editor/value_shapes.gd.uid +1 -0
- package/build/godot/addons/gdharness_runtime/reading.gd +65 -0
- package/build/godot/addons/gdharness_runtime/runtime_accessibility.gd +18 -18
- package/build/godot/addons/gdharness_runtime/runtime_autoload.gd +29 -29
- package/build/godot/addons/gdharness_runtime/runtime_capture.gd +21 -18
- package/build/godot/addons/gdharness_runtime/runtime_changes.gd +86 -80
- package/build/godot/addons/gdharness_runtime/runtime_input.gd +65 -64
- package/build/godot/addons/gdharness_runtime/runtime_items.gd +6 -6
- package/build/godot/addons/gdharness_runtime/runtime_menus.gd +8 -8
- package/build/godot/addons/gdharness_runtime/runtime_mouse.gd +6 -6
- package/build/godot/addons/gdharness_runtime/runtime_pad.gd +10 -10
- package/build/godot/addons/gdharness_runtime/runtime_paths.gd +7 -7
- package/build/godot/addons/gdharness_runtime/runtime_queries.gd +41 -41
- package/build/godot/addons/gdharness_runtime/runtime_says.gd +3 -3
- package/build/godot/addons/gdharness_runtime/runtime_targets.gd +33 -33
- package/build/godot/addons/gdharness_runtime/runtime_typing.gd +20 -20
- package/build/godot/addons/gdharness_runtime/runtime_values.gd +52 -25
- package/build/godot/addons/gdharness_runtime/runtime_waits.gd +56 -50
- package/build/godot/addons/gdharness_runtime/serialisation.gd +49 -94
- package/build/godot/addons/gdharness_runtime/value_shapes.gd +118 -0
- package/build/godot/addons/gdharness_runtime/value_shapes.gd.uid +1 -0
- package/build/godot/operations/animation_reads.gd +7 -19
- package/build/godot/operations/audio_buses.gd +10 -10
- package/build/godot/operations/class_cache.gd +16 -16
- package/build/godot/operations/classdb_queries.gd +25 -15
- package/build/godot/operations/declared_values.gd +116 -0
- package/build/godot/operations/dependencies.gd +141 -33
- package/build/godot/operations/editor_tools.gd +12 -12
- package/build/godot/operations/export_presets.gd +14 -14
- package/build/godot/operations/file_reads.gd +65 -25
- package/build/godot/operations/file_walk.gd +34 -0
- package/build/godot/operations/gdscript_analysis.gd +27 -22
- package/build/godot/operations/gdscript_authoring.gd +122 -17
- package/build/godot/operations/godot_operations.gd +66 -63
- package/build/godot/operations/import_pipeline.gd +59 -20
- package/build/godot/operations/input_actions.gd +90 -18
- package/build/godot/operations/logger.gd +1 -1
- package/build/godot/operations/plugins.gd +8 -8
- package/build/godot/operations/project_config.gd +83 -20
- package/build/godot/operations/project_diagnostics.gd +36 -11
- package/build/godot/operations/property_values.gd +222 -59
- package/build/godot/operations/reading.gd +65 -0
- package/build/godot/operations/rename_checks.gd +3 -3
- package/build/godot/operations/resource_files.gd +9 -6
- package/build/godot/operations/script_check.gd +23 -7
- package/build/godot/operations/serialisation.gd +49 -94
- package/build/godot/operations/value_shapes.gd +118 -0
- package/package.json +1 -1
|
@@ -23,14 +23,14 @@ extends RefCounted
|
|
|
23
23
|
## setter setting scale were both saved into the file by a write to another node, and a root whose
|
|
24
24
|
## script failed in [code]_init[/code] was saved without it. Outside the editor, then, what a node
|
|
25
25
|
## stores is put back to what the file holds wherever the tool did not ask for a change, before
|
|
26
|
-
## anything is saved, and a write is refused when that does not hold. See [
|
|
26
|
+
## anything is saved, and a write is refused when that does not hold. See [GdhHeadlessCheck].
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const GdhHeadlessCheck = preload("headless_check.gd")
|
|
29
29
|
|
|
30
30
|
## How many times what scripts changed is put back before a write is refused for it.
|
|
31
31
|
const PUTTING_BACK_PASSES: int = 4
|
|
32
|
-
const
|
|
33
|
-
const
|
|
32
|
+
const GdhPropertyValues = preload("property_values.gd")
|
|
33
|
+
const GdhRead = preload("reading.gd")
|
|
34
34
|
## The names Object.ConnectFlags gives each bit. The number alone left a reader guessing that 2 is
|
|
35
35
|
## the persistence every connection in a saved scene carries.
|
|
36
36
|
const CONNECT_FLAG_NAMES: Dictionary[int, String] = {
|
|
@@ -135,12 +135,12 @@ func asked(node: Node, names: Array) -> void:
|
|
|
135
135
|
var id: int = node.get_instance_id()
|
|
136
136
|
var on: Dictionary = _asked.get_or_add(id, {})
|
|
137
137
|
if not _before.has(id):
|
|
138
|
-
_before[id] =
|
|
138
|
+
_before[id] = GdhHeadlessCheck.stored(node)
|
|
139
139
|
for name: Variant in names:
|
|
140
140
|
var property: String = str(name)
|
|
141
141
|
on[property] = true
|
|
142
142
|
on[property.get_slice(":", 0)] = true
|
|
143
|
-
_reached.merge(
|
|
143
|
+
_reached.merge(GdhHeadlessCheck.reached(node, property))
|
|
144
144
|
|
|
145
145
|
|
|
146
146
|
## Takes [param resource], built into the scene, as one the tool changed, which a write saves as it is.
|
|
@@ -199,7 +199,7 @@ func not_found(said: String, node_path: String) -> String:
|
|
|
199
199
|
if root == null:
|
|
200
200
|
return said
|
|
201
201
|
if not root.has_node(NodePath(node_path.get_slice("/", 0))):
|
|
202
|
-
var hinted: String =
|
|
202
|
+
var hinted: String = GdhRead.from_the_root(said, node_path, str(root.name))
|
|
203
203
|
if hinted != said:
|
|
204
204
|
return hinted
|
|
205
205
|
var parts: PackedStringArray = node_path.trim_prefix("./").split("/", false)
|
|
@@ -216,7 +216,7 @@ func not_found(said: String, node_path: String) -> String:
|
|
|
216
216
|
var names: PackedStringArray = []
|
|
217
217
|
for child: Node in at.get_children():
|
|
218
218
|
var _named: bool = names.append(str(child.name))
|
|
219
|
-
return
|
|
219
|
+
return GdhRead.missing_below(said, str(root.name), reached, parts[reached.size()], names)
|
|
220
220
|
|
|
221
221
|
|
|
222
222
|
func close() -> void:
|
|
@@ -477,7 +477,7 @@ func kept(saved: Node, loaded: Variant, given: Variant) -> bool:
|
|
|
477
477
|
var loaded_node: Node = loaded
|
|
478
478
|
var given_node: Node = given
|
|
479
479
|
return str(saved.get_path_to(loaded_node)) == str(root.get_path_to(given_node))
|
|
480
|
-
return
|
|
480
|
+
return GdhPropertyValues.same(loaded, given)
|
|
481
481
|
|
|
482
482
|
|
|
483
483
|
## Packs [member root], has [param check] read the result as the file will hold it, and writes the
|
|
@@ -508,7 +508,7 @@ func write(check: Callable = Callable()) -> Dictionary:
|
|
|
508
508
|
)
|
|
509
509
|
% path
|
|
510
510
|
)
|
|
511
|
-
+
|
|
511
|
+
+ GdhHeadlessCheck.REMEDY
|
|
512
512
|
)
|
|
513
513
|
)
|
|
514
514
|
if check.is_valid():
|
|
@@ -530,12 +530,14 @@ func write(check: Callable = Callable()) -> Dictionary:
|
|
|
530
530
|
var values: Array = []
|
|
531
531
|
for index: int in state.get_node_count():
|
|
532
532
|
values.append_array(_stored_at(state, index).values())
|
|
533
|
-
var unkept: String =
|
|
533
|
+
var unkept: String = GdhHeadlessCheck.settle_saved(
|
|
534
534
|
path, _text, values, null, {}, _reached, func() -> Error: return save_keeping_uid(packed, path)
|
|
535
535
|
)
|
|
536
536
|
if unkept.is_empty():
|
|
537
537
|
return {}
|
|
538
|
-
return {
|
|
538
|
+
return {
|
|
539
|
+
"ok": false, "error": "Nothing was written: " + unkept + GdhHeadlessCheck.put_back(path, previous)
|
|
540
|
+
}
|
|
539
541
|
|
|
540
542
|
|
|
541
543
|
func _holds_scripted_embedded() -> bool:
|
|
@@ -543,7 +545,7 @@ func _holds_scripted_embedded() -> bool:
|
|
|
543
545
|
var nodes: Array[Node] = [root]
|
|
544
546
|
while not nodes.is_empty():
|
|
545
547
|
var node: Node = nodes.pop_back()
|
|
546
|
-
if
|
|
548
|
+
if GdhHeadlessCheck.holds_scripted_embedded(node, seen):
|
|
547
549
|
return true
|
|
548
550
|
nodes.append_array(node.get_children())
|
|
549
551
|
return false
|
|
@@ -742,7 +744,7 @@ func _settled(packed: PackedScene) -> Array:
|
|
|
742
744
|
var node: Node = found[0]
|
|
743
745
|
var before: Dictionary = _before[node.get_instance_id()]
|
|
744
746
|
for name: String in found[1]:
|
|
745
|
-
node.set(name, before.get(name,
|
|
747
|
+
node.set(name, before.get(name, GdhHeadlessCheck.default_of(node, name)))
|
|
746
748
|
current = PackedScene.new()
|
|
747
749
|
var packing: Error = current.pack(root)
|
|
748
750
|
if packing != OK:
|
|
@@ -766,10 +768,10 @@ func _moved_by_scripts() -> Array[Array]:
|
|
|
766
768
|
if node == null or not root.is_ancestor_of(node) and node != root:
|
|
767
769
|
continue
|
|
768
770
|
var on: Dictionary = _asked[id]
|
|
769
|
-
if not
|
|
771
|
+
if not GdhHeadlessCheck.through_script(node, on):
|
|
770
772
|
continue
|
|
771
773
|
var before: Dictionary = _before[id]
|
|
772
|
-
var changed: Array[String] =
|
|
774
|
+
var changed: Array[String] = GdhHeadlessCheck.differing(node, before, on)
|
|
773
775
|
if not changed.is_empty():
|
|
774
776
|
moved.append([node, changed])
|
|
775
777
|
return moved
|
|
@@ -792,7 +794,10 @@ func _strays(state: SceneState) -> Array[Array]:
|
|
|
792
794
|
# changes is Godot's doing and the editor's pack does it too: a Control saved without its
|
|
793
795
|
# grow directions gets them back from anchors_preset's setter, and loses an anchors_preset
|
|
794
796
|
# its layout mode does not store.
|
|
795
|
-
if
|
|
797
|
+
if (
|
|
798
|
+
not GdhHeadlessCheck.untooled(node.get_script())
|
|
799
|
+
and not GdhHeadlessCheck.untooled(filed.get("script"))
|
|
800
|
+
):
|
|
796
801
|
continue
|
|
797
802
|
var stored: Dictionary = _stored_at(state, index)
|
|
798
803
|
var names: Dictionary = filed.duplicate()
|
|
@@ -800,9 +805,9 @@ func _strays(state: SceneState) -> Array[Array]:
|
|
|
800
805
|
for key: Variant in names:
|
|
801
806
|
var name: String = str(key)
|
|
802
807
|
var held: bool = filed.has(name)
|
|
803
|
-
if held == stored.has(name) and (not held or
|
|
808
|
+
if held == stored.has(name) and (not held or GdhPropertyValues.same(stored[name], filed[name])):
|
|
804
809
|
continue
|
|
805
|
-
if not held and
|
|
810
|
+
if not held and GdhHeadlessCheck.at_default(node, name):
|
|
806
811
|
continue
|
|
807
812
|
stray.append([node, name, held, filed.get(name)])
|
|
808
813
|
return stray
|
|
@@ -819,7 +824,7 @@ func _stray_text(node: Node, name: String) -> String:
|
|
|
819
824
|
)
|
|
820
825
|
% [at, path]
|
|
821
826
|
)
|
|
822
|
-
+
|
|
827
|
+
+ GdhHeadlessCheck.REMEDY
|
|
823
828
|
)
|
|
824
829
|
return (
|
|
825
830
|
(
|
|
@@ -830,7 +835,7 @@ func _stray_text(node: Node, name: String) -> String:
|
|
|
830
835
|
)
|
|
831
836
|
% [at, name, path]
|
|
832
837
|
)
|
|
833
|
-
+
|
|
838
|
+
+ GdhHeadlessCheck.REMEDY
|
|
834
839
|
)
|
|
835
840
|
|
|
836
841
|
|
|
@@ -845,7 +850,7 @@ func _unset_value(node: Node, name: String) -> Variant:
|
|
|
845
850
|
while top != root and top.owner != root:
|
|
846
851
|
top = top.get_parent()
|
|
847
852
|
if top == root or top.scene_file_path.is_empty():
|
|
848
|
-
return
|
|
853
|
+
return GdhHeadlessCheck.default_of(node, name)
|
|
849
854
|
if _base_paths.has(path_of(top)):
|
|
850
855
|
return _value_in(base, path_of(node), node, name)
|
|
851
856
|
var instanced: PackedScene = ResourceLoader.load(top.scene_file_path) as PackedScene
|
|
@@ -881,7 +886,7 @@ func _value_in(state: SceneState, at: String, node: Node, name: String) -> Varia
|
|
|
881
886
|
state = instanced.get_state()
|
|
882
887
|
else:
|
|
883
888
|
state = state.get_base_scene_state()
|
|
884
|
-
return
|
|
889
|
+
return GdhHeadlessCheck.default_of(node, name)
|
|
885
890
|
|
|
886
891
|
|
|
887
892
|
func _node_at(node_path: String) -> Node:
|
|
@@ -8,7 +8,8 @@ extends RefCounted
|
|
|
8
8
|
## before: the same Vector2 came back three ways depending on which tool was asked, and a caller
|
|
9
9
|
## reading a property off the editor could not feed it back to the game.
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const GdhRead = preload("reading.gd")
|
|
12
|
+
const GdhShapes = preload("value_shapes.gd")
|
|
12
13
|
|
|
13
14
|
# What the engine carries from one to another without complaint, which is what a value written to a
|
|
14
15
|
# property or handed to a parameter may arrive as. Numbers include bool because the engine counts it
|
|
@@ -120,35 +121,6 @@ const BUILDERS: Dictionary = {
|
|
|
120
121
|
"Dictionary": "_build_dictionary",
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
# What each tag has to carry before it is built. A tag naming a type whose keys are not there is a
|
|
124
|
-
# tag somebody wrote by mistake or wrote for a different shape, and building one out of defaults
|
|
125
|
-
# answers with a Transform2D of zeros where the caller meant something else entirely. Unbuilt, it
|
|
126
|
-
# comes back as it arrived, and whoever asked can read it against the type they were expecting.
|
|
127
|
-
const REQUIRED: Dictionary = {
|
|
128
|
-
"Vector2": [["x", "y"]],
|
|
129
|
-
"Vector2i": [["x", "y"]],
|
|
130
|
-
"Vector3": [["x", "y", "z"]],
|
|
131
|
-
"Vector3i": [["x", "y", "z"]],
|
|
132
|
-
"Vector4": [["x", "y", "z", "w"]],
|
|
133
|
-
"Vector4i": [["x", "y", "z", "w"]],
|
|
134
|
-
"Rect2": [["position", "size"], ["x", "y", "width", "height"]],
|
|
135
|
-
"Rect2i": [["position", "size"], ["x", "y", "width", "height"]],
|
|
136
|
-
"Plane": [["normal", "d"]],
|
|
137
|
-
"Quaternion": [["x", "y", "z", "w"]],
|
|
138
|
-
"AABB": [["position", "size"]],
|
|
139
|
-
"Basis": [["x", "y", "z"]],
|
|
140
|
-
"Transform2D": [["x", "y", "origin"]],
|
|
141
|
-
"Transform3D": [["basis", "origin"]],
|
|
142
|
-
"Projection": [["x", "y", "z", "w"]],
|
|
143
|
-
"Color": [["r", "g", "b"]],
|
|
144
|
-
"NodePath": [["path"]],
|
|
145
|
-
"PackedByteArray": [["base64"]],
|
|
146
|
-
"float": [["value"]],
|
|
147
|
-
"int": [["value"]],
|
|
148
|
-
"RID": [["id"]],
|
|
149
|
-
"Dictionary": [["entries"]],
|
|
150
|
-
}
|
|
151
|
-
|
|
152
124
|
|
|
153
125
|
# Converts a Godot value into something JSON can carry. A type with no entry in the table
|
|
154
126
|
# passes through as itself, which is what the JSON-native ones want.
|
|
@@ -246,8 +218,8 @@ func deserialize_value(value: Variant) -> Variant:
|
|
|
246
218
|
# under the target project's warning levels, so one such project lost every headless call.
|
|
247
219
|
var tag: String = str(fields["_type"])
|
|
248
220
|
var builder: String = BUILDERS.get(tag, "")
|
|
249
|
-
var
|
|
250
|
-
if builder.is_empty() or not
|
|
221
|
+
var spare: Array = GdhShapes.spare(fields, tag)
|
|
222
|
+
if builder.is_empty() or not spare.any(func(left: Array) -> bool: return left.is_empty()):
|
|
251
223
|
return fields
|
|
252
224
|
if tag == "float" and str(fields["value"]) not in ["inf", "-inf", "nan"]:
|
|
253
225
|
return fields
|
|
@@ -430,9 +402,18 @@ func fitted(value: Variant, type: int) -> Variant:
|
|
|
430
402
|
if rebuilt is Array and LIST_TYPES.has(type):
|
|
431
403
|
return type_convert(rebuilt, type)
|
|
432
404
|
|
|
405
|
+
# The inspector and every colour picker give a colour as its html code. Anything else stays the
|
|
406
|
+
# text it is, for the refusal to name.
|
|
407
|
+
if type == TYPE_COLOR and rebuilt is String and Color.html_is_valid(str(rebuilt)):
|
|
408
|
+
return Color.html(str(rebuilt))
|
|
409
|
+
|
|
433
410
|
var simple: Array[int] = [TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING]
|
|
434
411
|
if not simple.has(type) or not simple.has(typeof(rebuilt)):
|
|
435
412
|
return rebuilt
|
|
413
|
+
# A number or a truth value stays as sent where text is wanted, for the refusal to name. Converted,
|
|
414
|
+
# 1 arrived as the double it is in JSON and was saved as "1.0", which is not the text anyone sends.
|
|
415
|
+
if type == TYPE_STRING and not rebuilt is String:
|
|
416
|
+
return rebuilt
|
|
436
417
|
|
|
437
418
|
# Digits are read as digits, since read as JSON they become a double and one past 2^53 a
|
|
438
419
|
# neighbour of the number written.
|
|
@@ -441,7 +422,7 @@ func fitted(value: Variant, type: int) -> Variant:
|
|
|
441
422
|
|
|
442
423
|
if rebuilt is String and type != TYPE_STRING:
|
|
443
424
|
var text: String = rebuilt
|
|
444
|
-
var parsed: Variant =
|
|
425
|
+
var parsed: Variant = GdhRead.json_or_null(text)
|
|
445
426
|
# A string that does not read as the type wanted is handed back as the string it is, so
|
|
446
427
|
# whoever asked can refuse it. type_convert answers 0 for "not an index" and true for any
|
|
447
428
|
# text at all, and a caller who sent a word got back a number they never sent: get_child
|
|
@@ -461,7 +442,7 @@ func fitted(value: Variant, type: int) -> Variant:
|
|
|
461
442
|
static func inexact(given: Variant, type: int) -> String:
|
|
462
443
|
if type != TYPE_INT or (typeof(given) != TYPE_FLOAT and typeof(given) != TYPE_INT):
|
|
463
444
|
return ""
|
|
464
|
-
var number: float =
|
|
445
|
+
var number: float = GdhRead.as_float(given)
|
|
465
446
|
if not is_finite(number) or absf(number) < EXACT:
|
|
466
447
|
return ""
|
|
467
448
|
return (
|
|
@@ -474,34 +455,6 @@ static func inexact(given: Variant, type: int) -> String:
|
|
|
474
455
|
)
|
|
475
456
|
|
|
476
457
|
|
|
477
|
-
## How a value of [param type] is written to be read as one, for a refusal to name, or empty for a
|
|
478
|
-
## type that is not built from fields. A refusal naming only the two types left a caller to find
|
|
479
|
-
## the shape in the description of another op.
|
|
480
|
-
static func written_as(type: int) -> String:
|
|
481
|
-
var tag: String = type_string(type)
|
|
482
|
-
var alternatives: Array = REQUIRED.get(tag, [])
|
|
483
|
-
if alternatives.is_empty() or tag in ["float", "int", "Dictionary"]:
|
|
484
|
-
return ""
|
|
485
|
-
var keys: Array = alternatives[0]
|
|
486
|
-
var parts: Array[String] = []
|
|
487
|
-
for key: Variant in keys:
|
|
488
|
-
parts.append('"%s": ...' % key)
|
|
489
|
-
return "{%s}" % ", ".join(parts)
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
## Whether [param fields] carries every key of any one of [param alternatives].
|
|
493
|
-
##
|
|
494
|
-
## More than one spelling because a rectangle has two: the two corners it is answered with, and the
|
|
495
|
-
## four numbers the editor's own tools answered with before the serialisers were made one, which a
|
|
496
|
-
## caller may have kept.
|
|
497
|
-
func _carries(fields: Dictionary, alternatives: Array) -> bool:
|
|
498
|
-
for alternative: Variant in alternatives:
|
|
499
|
-
var keys: Array = alternative
|
|
500
|
-
if keys.all(func(key: Variant) -> bool: return fields.has(key)):
|
|
501
|
-
return true
|
|
502
|
-
return false
|
|
503
|
-
|
|
504
|
-
|
|
505
458
|
func _serialize_nil(_value: Variant) -> Variant:
|
|
506
459
|
return null
|
|
507
460
|
|
|
@@ -769,42 +722,44 @@ func _describe_object(value: Object) -> Dictionary:
|
|
|
769
722
|
|
|
770
723
|
|
|
771
724
|
func _build_vector2(fields: Dictionary) -> Vector2:
|
|
772
|
-
return Vector2(
|
|
725
|
+
return Vector2(GdhRead.as_float(fields.get("x", 0)), GdhRead.as_float(fields.get("y", 0)))
|
|
773
726
|
|
|
774
727
|
|
|
775
728
|
func _build_vector2i(fields: Dictionary) -> Vector2i:
|
|
776
|
-
return Vector2i(
|
|
729
|
+
return Vector2i(GdhRead.as_int(fields.get("x", 0)), GdhRead.as_int(fields.get("y", 0)))
|
|
777
730
|
|
|
778
731
|
|
|
779
732
|
func _build_vector3(fields: Dictionary) -> Vector3:
|
|
780
733
|
return Vector3(
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
734
|
+
GdhRead.as_float(fields.get("x", 0)),
|
|
735
|
+
GdhRead.as_float(fields.get("y", 0)),
|
|
736
|
+
GdhRead.as_float(fields.get("z", 0))
|
|
784
737
|
)
|
|
785
738
|
|
|
786
739
|
|
|
787
740
|
func _build_vector3i(fields: Dictionary) -> Vector3i:
|
|
788
741
|
return Vector3i(
|
|
789
|
-
|
|
742
|
+
GdhRead.as_int(fields.get("x", 0)),
|
|
743
|
+
GdhRead.as_int(fields.get("y", 0)),
|
|
744
|
+
GdhRead.as_int(fields.get("z", 0))
|
|
790
745
|
)
|
|
791
746
|
|
|
792
747
|
|
|
793
748
|
func _build_vector4(fields: Dictionary) -> Vector4:
|
|
794
749
|
return Vector4(
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
750
|
+
GdhRead.as_float(fields.get("x", 0)),
|
|
751
|
+
GdhRead.as_float(fields.get("y", 0)),
|
|
752
|
+
GdhRead.as_float(fields.get("z", 0)),
|
|
753
|
+
GdhRead.as_float(fields.get("w", 0))
|
|
799
754
|
)
|
|
800
755
|
|
|
801
756
|
|
|
802
757
|
func _build_vector4i(fields: Dictionary) -> Vector4i:
|
|
803
758
|
return Vector4i(
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
759
|
+
GdhRead.as_int(fields.get("x", 0)),
|
|
760
|
+
GdhRead.as_int(fields.get("y", 0)),
|
|
761
|
+
GdhRead.as_int(fields.get("z", 0)),
|
|
762
|
+
GdhRead.as_int(fields.get("w", 0))
|
|
808
763
|
)
|
|
809
764
|
|
|
810
765
|
|
|
@@ -813,10 +768,10 @@ func _build_vector4i(fields: Dictionary) -> Vector4i:
|
|
|
813
768
|
func _build_rect2(fields: Dictionary) -> Rect2:
|
|
814
769
|
if not fields.has("position"):
|
|
815
770
|
return Rect2(
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
771
|
+
GdhRead.as_float(fields.get("x", 0)),
|
|
772
|
+
GdhRead.as_float(fields.get("y", 0)),
|
|
773
|
+
GdhRead.as_float(fields.get("width", 0)),
|
|
774
|
+
GdhRead.as_float(fields.get("height", 0))
|
|
820
775
|
)
|
|
821
776
|
return Rect2(_vector2_at(fields, "position"), _vector2_at(fields, "size"))
|
|
822
777
|
|
|
@@ -824,24 +779,24 @@ func _build_rect2(fields: Dictionary) -> Rect2:
|
|
|
824
779
|
func _build_rect2i(fields: Dictionary) -> Rect2i:
|
|
825
780
|
if not fields.has("position"):
|
|
826
781
|
return Rect2i(
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
782
|
+
GdhRead.as_int(fields.get("x", 0)),
|
|
783
|
+
GdhRead.as_int(fields.get("y", 0)),
|
|
784
|
+
GdhRead.as_int(fields.get("width", 0)),
|
|
785
|
+
GdhRead.as_int(fields.get("height", 0))
|
|
831
786
|
)
|
|
832
787
|
return Rect2i(_vector2i_at(fields, "position"), _vector2i_at(fields, "size"))
|
|
833
788
|
|
|
834
789
|
|
|
835
790
|
func _build_plane(fields: Dictionary) -> Plane:
|
|
836
|
-
return Plane(_vector3_at(fields, "normal"),
|
|
791
|
+
return Plane(_vector3_at(fields, "normal"), GdhRead.as_float(fields.get("d", 0)))
|
|
837
792
|
|
|
838
793
|
|
|
839
794
|
func _build_quaternion(fields: Dictionary) -> Quaternion:
|
|
840
795
|
return Quaternion(
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
796
|
+
GdhRead.as_float(fields.get("x", 0)),
|
|
797
|
+
GdhRead.as_float(fields.get("y", 0)),
|
|
798
|
+
GdhRead.as_float(fields.get("z", 0)),
|
|
799
|
+
GdhRead.as_float(fields.get("w", 0))
|
|
845
800
|
)
|
|
846
801
|
|
|
847
802
|
|
|
@@ -881,10 +836,10 @@ func _build_projection(fields: Dictionary) -> Projection:
|
|
|
881
836
|
|
|
882
837
|
func _build_color(fields: Dictionary) -> Color:
|
|
883
838
|
return Color(
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
839
|
+
GdhRead.as_float(fields.get("r", 0)),
|
|
840
|
+
GdhRead.as_float(fields.get("g", 0)),
|
|
841
|
+
GdhRead.as_float(fields.get("b", 0)),
|
|
842
|
+
GdhRead.as_float(fields.get("a", 1), 1.0)
|
|
888
843
|
)
|
|
889
844
|
|
|
890
845
|
|
|
@@ -897,7 +852,7 @@ func _build_bytes(fields: Dictionary) -> PackedByteArray:
|
|
|
897
852
|
|
|
898
853
|
|
|
899
854
|
func _build_float(fields: Dictionary) -> float:
|
|
900
|
-
return
|
|
855
|
+
return GdhRead.as_float(fields)
|
|
901
856
|
|
|
902
857
|
|
|
903
858
|
func _build_int(fields: Dictionary) -> int:
|
|
@@ -5,25 +5,25 @@ extends Node
|
|
|
5
5
|
## preloaded rather than looked up on disk at runtime, so a missing one fails to parse here
|
|
6
6
|
## instead of leaving a command silently unanswered.
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
8
|
+
const GdhSceneTools = preload("tools/scene_tools.gd")
|
|
9
|
+
const GdhResourceTools = preload("tools/resource_tools.gd")
|
|
10
|
+
const GdhAnimationTools = preload("tools/animation_tools.gd")
|
|
11
|
+
const GdhPlayTools = preload("tools/play_tools.gd")
|
|
12
|
+
const GdhClassTools = preload("tools/class_tools.gd")
|
|
13
|
+
const GdhSettingsTools = preload("tools/settings_tools.gd")
|
|
14
|
+
const GdhFilesystemTools = preload("tools/filesystem_tools.gd")
|
|
15
|
+
const GdhProfileTools = preload("tools/profile_tools.gd")
|
|
16
16
|
|
|
17
17
|
var _editor_plugin: EditorPlugin = null
|
|
18
18
|
|
|
19
|
-
var _scene_tools:
|
|
20
|
-
var _resource_tools:
|
|
21
|
-
var _animation_tools:
|
|
22
|
-
var _play_tools:
|
|
23
|
-
var _class_tools:
|
|
24
|
-
var _settings_tools:
|
|
25
|
-
var _filesystem_tools:
|
|
26
|
-
var _profile_tools:
|
|
19
|
+
var _scene_tools: GdhSceneTools = null
|
|
20
|
+
var _resource_tools: GdhResourceTools = null
|
|
21
|
+
var _animation_tools: GdhAnimationTools = null
|
|
22
|
+
var _play_tools: GdhPlayTools = null
|
|
23
|
+
var _class_tools: GdhClassTools = null
|
|
24
|
+
var _settings_tools: GdhSettingsTools = null
|
|
25
|
+
var _filesystem_tools: GdhFilesystemTools = null
|
|
26
|
+
var _profile_tools: GdhProfileTools = null
|
|
27
27
|
|
|
28
28
|
var _tool_map: Dictionary = {}
|
|
29
29
|
var _initialized: bool = false
|
|
@@ -46,35 +46,35 @@ func _init_tools() -> void:
|
|
|
46
46
|
return
|
|
47
47
|
_initialized = true
|
|
48
48
|
|
|
49
|
-
_scene_tools =
|
|
49
|
+
_scene_tools = GdhSceneTools.new()
|
|
50
50
|
_scene_tools.name = "SceneTools"
|
|
51
51
|
add_child(_scene_tools)
|
|
52
52
|
|
|
53
|
-
_resource_tools =
|
|
53
|
+
_resource_tools = GdhResourceTools.new()
|
|
54
54
|
_resource_tools.name = "ResourceTools"
|
|
55
55
|
add_child(_resource_tools)
|
|
56
56
|
|
|
57
|
-
_animation_tools =
|
|
57
|
+
_animation_tools = GdhAnimationTools.new()
|
|
58
58
|
_animation_tools.name = "AnimationTools"
|
|
59
59
|
add_child(_animation_tools)
|
|
60
60
|
|
|
61
|
-
_play_tools =
|
|
61
|
+
_play_tools = GdhPlayTools.new()
|
|
62
62
|
_play_tools.name = "PlayTools"
|
|
63
63
|
add_child(_play_tools)
|
|
64
64
|
|
|
65
|
-
_class_tools =
|
|
65
|
+
_class_tools = GdhClassTools.new()
|
|
66
66
|
_class_tools.name = "ClassTools"
|
|
67
67
|
add_child(_class_tools)
|
|
68
68
|
|
|
69
|
-
_settings_tools =
|
|
69
|
+
_settings_tools = GdhSettingsTools.new()
|
|
70
70
|
_settings_tools.name = "SettingsTools"
|
|
71
71
|
add_child(_settings_tools)
|
|
72
72
|
|
|
73
|
-
_filesystem_tools =
|
|
73
|
+
_filesystem_tools = GdhFilesystemTools.new()
|
|
74
74
|
_filesystem_tools.name = "FilesystemTools"
|
|
75
75
|
add_child(_filesystem_tools)
|
|
76
76
|
|
|
77
|
-
_profile_tools =
|
|
77
|
+
_profile_tools = GdhProfileTools.new()
|
|
78
78
|
_profile_tools.name = "ProfileTools"
|
|
79
79
|
add_child(_profile_tools)
|
|
80
80
|
|