Files
RoboMovel/simulacao/robo-movel-godot/addons/claude_godot/agent/tools/tool_screenshot.gd
T
mguinhosandClaude Opus 5.5 393019705c Projeto: app demo, servidor/firmware em software/, simulacao Godot, planta do bloco D, chapas MDF da base, renders e slides
- app/: app demo (Kivy/buildozer) da API do robo
- software/: servidor RoboMovel (SLAM, profundidade, navegacao) e firmware da base movel (movido de firmware/)
- simulacao/: projeto Godot do robo e script de lancamento servidor + simulacao
- modelos/: planta do 5o andar do bloco D, cena Blender do corredor e modelo real do robo
- partes/mdf/: chapas identificadas e nesting da base do robo (DXF/SVG/FCStd)
- projeto/render, relatorio/imagens, slides: renders finais e apresentacoes de progresso
- ferramentas/scripts: encaixe de chapas, planta do bloco D e render do corredor no Blender
- .gitignore: ignora backups do Blender/FreeCAD e .godot/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:38:16 -03:00

47 lines
1.7 KiB
GDScript

## Captures what the editor is currently showing — a scene, a layout, a
## rendering glitch. Saving and looking are separate steps on purpose: this
## writes the file, and read_file is what puts it in front of the model.
class_name ClaudeGodotToolScreenshot
extends ClaudeGodotTool
const DEFAULT_PATH := "res://claude_godot_screenshot.png"
func definition() -> Dictionary:
return {
"name": "screenshot",
"description": "Capture the editor window to a PNG in the project and return its path and size. To actually look at it, call read_file on that path — it attaches images when the model accepts them.",
"input_schema": {
"type": "object",
"properties": {
"path": {"type": "string", "description": "Where to save it. Defaults to '%s'." % DEFAULT_PATH}
}
}
}
func execute(input: Dictionary) -> Dictionary:
var path := resolve_path(input.get("path", DEFAULT_PATH))
if not path.to_lower().ends_with(".png"):
path += ".png"
var viewport := EditorInterface.get_base_control().get_viewport()
if viewport == null:
return {"is_error": true, "content": "No editor viewport to capture."}
var texture := viewport.get_texture()
if texture == null:
return {"is_error": true, "content": "Editor viewport has no texture to capture."}
var image := texture.get_image()
if image == null or image.is_empty():
return {"is_error": true, "content": "Captured an empty image."}
var err := image.save_png(path)
if err != OK:
return {"is_error": true, "content": "Could not write %s: %s" % [path, error_string(err)]}
EditorInterface.get_resource_filesystem().update_file(path)
return {
"content": "Saved a %dx%d screenshot to %s. read_file it to look at it." % [image.get_width(), image.get_height(), path],
"path": path,
}