gopeak 2.0.0

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.
@@ -0,0 +1,126 @@
1
+ @tool
2
+ extends EditorPlugin
3
+
4
+ ## Auto Reload Plugin for Godot MCP
5
+ ## Automatically reloads scenes and scripts when modified externally
6
+ ##
7
+ ## Features:
8
+ ## - Auto-detects external file changes (scenes, scripts, resources)
9
+ ## - Reloads without confirmation popup
10
+ ## - Lightweight 1-second polling (negligible performance impact)
11
+ ## - Perfect for MCP integration workflow
12
+
13
+ var check_interval: float = 1.0 # Check every 1 second
14
+ var timer: Timer
15
+ var watched_files: Dictionary = {} # {path: last_modified_time}
16
+ var editor_interface: EditorInterface
17
+
18
+ # File extensions to watch
19
+ var watched_extensions: Array[String] = [".tscn", ".scn", ".gd", ".tres", ".res"]
20
+
21
+ func _enter_tree() -> void:
22
+ editor_interface = get_editor_interface()
23
+
24
+ # Create timer for periodic file checking
25
+ timer = Timer.new()
26
+ timer.wait_time = check_interval
27
+ timer.timeout.connect(_check_for_changes)
28
+ add_child(timer)
29
+ timer.start()
30
+
31
+ # Initial scan of open scenes
32
+ _update_watched_files()
33
+
34
+ print("[Godot MCP - AutoReload] Plugin activated - watching for external changes")
35
+
36
+ func _exit_tree() -> void:
37
+ if timer:
38
+ timer.stop()
39
+ timer.queue_free()
40
+ print("[Godot MCP - AutoReload] Plugin deactivated")
41
+
42
+ func _update_watched_files() -> void:
43
+ # Get currently edited scene
44
+ var edited_scene = editor_interface.get_edited_scene_root()
45
+ if edited_scene and edited_scene.scene_file_path:
46
+ var path = edited_scene.scene_file_path
47
+ if not watched_files.has(path):
48
+ watched_files[path] = _get_modified_time(path)
49
+
50
+ # Also watch attached scripts
51
+ _watch_node_scripts(edited_scene)
52
+
53
+ func _watch_node_scripts(node: Node) -> void:
54
+ # Watch the script attached to this node
55
+ var script = node.get_script()
56
+ if script and script.resource_path:
57
+ var path = script.resource_path
58
+ if not watched_files.has(path):
59
+ watched_files[path] = _get_modified_time(path)
60
+
61
+ # Recursively watch children
62
+ for child in node.get_children():
63
+ _watch_node_scripts(child)
64
+
65
+ func _get_modified_time(path: String) -> int:
66
+ var global_path = ProjectSettings.globalize_path(path)
67
+ if FileAccess.file_exists(global_path):
68
+ return FileAccess.get_modified_time(global_path)
69
+ return 0
70
+
71
+ func _check_for_changes() -> void:
72
+ _update_watched_files()
73
+
74
+ var files_to_reload: Array = []
75
+ var scripts_to_reload: Array = []
76
+
77
+ for path in watched_files.keys():
78
+ var current_time = _get_modified_time(path)
79
+ var last_time = watched_files[path]
80
+
81
+ if current_time > last_time:
82
+ if path.ends_with(".gd"):
83
+ scripts_to_reload.append(path)
84
+ else:
85
+ files_to_reload.append(path)
86
+ watched_files[path] = current_time
87
+
88
+ # Reload changed scripts first
89
+ for path in scripts_to_reload:
90
+ _reload_script(path)
91
+
92
+ # Then reload changed scenes
93
+ for path in files_to_reload:
94
+ _reload_scene(path)
95
+
96
+ func _reload_script(path: String) -> void:
97
+ print("[Godot MCP - AutoReload] Script changed: ", path)
98
+
99
+ # Reload the script resource
100
+ var script = load(path)
101
+ if script:
102
+ ResourceLoader.load(path, "", ResourceLoader.CACHE_MODE_REPLACE)
103
+ print("[Godot MCP - AutoReload] Script reloaded: ", path)
104
+
105
+ func _reload_scene(path: String) -> void:
106
+ print("[Godot MCP - AutoReload] Scene changed: ", path)
107
+
108
+ # Check if this is the currently edited scene
109
+ var edited_scene = editor_interface.get_edited_scene_root()
110
+ if edited_scene and edited_scene.scene_file_path == path:
111
+ # Reload the current scene
112
+ editor_interface.reload_scene_from_path(path)
113
+ print("[Godot MCP - AutoReload] Scene reloaded: ", path)
114
+
115
+ # Public API for configuration
116
+ func set_check_interval(interval: float) -> void:
117
+ check_interval = interval
118
+ if timer:
119
+ timer.wait_time = interval
120
+
121
+ func add_watched_extension(ext: String) -> void:
122
+ if not watched_extensions.has(ext):
123
+ watched_extensions.append(ext)
124
+
125
+ func clear_watched_files() -> void:
126
+ watched_files.clear()
@@ -0,0 +1 @@
1
+ uid://bjgrdhriuh4ny
@@ -0,0 +1,7 @@
1
+ [plugin]
2
+
3
+ name="Godot MCP Auto Reload"
4
+ description="Automatically reload scenes and scripts when modified externally. Essential for MCP (Model Context Protocol) integration workflow."
5
+ author="HaD0Yun"
6
+ version="1.0.0"
7
+ script="auto_reload.gd"
@@ -0,0 +1,33 @@
1
+ @tool
2
+ extends EditorPlugin
3
+
4
+ ## Godot MCP Runtime Plugin
5
+ ## Enables real-time communication between a running Godot game and the MCP server.
6
+ ##
7
+ ## This plugin provides:
8
+ ## - WebSocket server for bidirectional communication
9
+ ## - Scene tree inspection
10
+ ## - Property modification at runtime
11
+ ## - Method calling at runtime
12
+ ## - Performance metrics reporting
13
+ ## - Signal watching
14
+
15
+ const DEFAULT_PORT = 7777
16
+ const PROTOCOL_VERSION = "1.0"
17
+
18
+ var _server: TCPServer
19
+ var _clients: Array[StreamPeerTCP] = []
20
+ var _port: int = DEFAULT_PORT
21
+ var _enabled: bool = false
22
+
23
+
24
+ func _enter_tree() -> void:
25
+ # Plugin initialization
26
+ print("[MCP Runtime] Plugin loaded")
27
+ add_autoload_singleton("MCPRuntime", "res://addons/godot_mcp_runtime/mcp_runtime_autoload.gd")
28
+
29
+
30
+ func _exit_tree() -> void:
31
+ # Cleanup
32
+ remove_autoload_singleton("MCPRuntime")
33
+ print("[MCP Runtime] Plugin unloaded")
@@ -0,0 +1 @@
1
+ uid://chxpbh0uj33us