extends Node
## GATE — Ctrl+Tab = Blender 2.79's select-mode menu (Mesh: wm.call_menu
## VIEW3D_MT_edit_mesh_select_mode; #109 step 6): Vertex / Edge / Face (and our Brush),
## the same actions as 1 2 3 4, so each row shows its key.
## M1 Ctrl+Tab (Keymap.run, the real path) opens the menu with the four select modes
## M2 picking Edge sets edge mode
## M3 again, picking Brush sets brush mode
## RUN AS A SCENE: "$HYPER_TPS_GODOT" --headless res://scenes/test/gate_select_mode_menu.tscn
var fails := 0
var checks := 0
func _ok(what: String, cond: bool, note: Variant = "") -> void:
checks += 1
if not cond:
fails += 1
print(" %-64s %s %s" % [what, "OK" if cond else "**FAIL**", str(note)])
func _ready() -> void:
var keet: Node = get_tree().root.get_node_or_null("/root/KeetService")
if keet != null:
keet.current_member_id = "gate-author"
get_tree().root.get_node("/root/GameMode").set_mode("build")
var map: Node3D = (load("res://scenes/maps/map_test.tscn") as PackedScene).instantiate()
add_child(map)
for i in 8:
await get_tree().process_frame
var q: Node = map.get("_q_menu")
Keymap.run("builder.select_mode_menu")
await get_tree().process_frame
var rows: Array = q.get("_actions") if q != null else []
_ok("M1 Ctrl+Tab opens the select-mode menu", q != null and bool(q.call("is_open")) and rows == [
"build_mode.sel_vertex", "build_mode.sel_edge", "build_mode.sel_face", "build_mode.sel_brush"], rows)
if q != null:
q.call("pick", "build_mode.sel_edge")
for f in 5: # pick waits 2 frames, then the replayed key lands
await get_tree().process_frame
_ok("M2 picking Edge sets edge mode", String(map.get("_sel_mode")) == "edge", map.get("_sel_mode"))
Keymap.run("builder.select_mode_menu")
await get_tree().process_frame
if q != null:
q.call("pick", "build_mode.sel_brush")
for f in 5:
await get_tree().process_frame
_ok("M3 picking Brush sets brush mode", String(map.get("_sel_mode")) == "brush", map.get("_sel_mode"))
get_tree().root.get_node("/root/GameMode").set_mode("play")
print("\nGATE select_mode_menu: %s (%d checks, %d failed)" % ["PASS" if fails == 0 else "FAIL", checks, fails])
get_tree().quit(0 if fails == 0 else 1)