A Godot 4.6 editor plugin that analyzes large .tscn scene files, exports embedded sub-resources to external binary .res files, and can re-import them. Helps reduce scene file bloat and improve version control diffs for projects with heavily embedded resources.
- Scene scanning -- Scan your project for
.tscnfiles and list them by size and embedded resource count - Resource analysis -- Break down embedded sub-resources by type (textures, materials, styles, etc.) with size estimates
- Export to external
.res-- Extract embedded sub-resources into standalone binary.resfiles (filters out resources < 100 KB) - Re-import -- Merge exported external resources back into the scene file
- Verification -- Sub-resource counts are compared before and after operations to catch errors
- Copy the
addons/scene_resource_debugger/directory into your project'saddons/folder - Enable the plugin in Project > Project Settings > Plugins
- The debugger panel appears in the editor's Debugger bottom panel
- Click Scan to find all
.tscnfiles in your project - Select a scene from the list to see its embedded resource breakdown
- Choose an export directory and click Export All or select individual resources to export
- Exported resources are saved as binary
.resfiles and the scene is rewritten to reference them as external resources - To reverse the process, select a scene and click Import All to re-embed external resources
Scene files are manipulated via RegEx-based text rewriting rather than Godot's resource API. This preserves formatting, comments, and UID references.
Export workflow:
- Walk the instantiated scene tree and collect embedded resources
- Topologically sort resources by dependency order (leaf-first)
- Save each resource as a binary
.resfile - Rewrite the
.tscnto replace[sub_resource]blocks with[ext_resource]references
Import workflow:
- Load external
.resfiles and serialize to temporary.tres - Parse
.tressections and remap IDs to avoid conflicts - Rewrite the
.tscnto embed the resources back inline - Clean up temporary files and optionally delete orphaned
.resfiles
addons/scene_resource_debugger/
plugin.gd # Entry point (EditorDebuggerPlugin)
debugger_panel.gd # Main UI panel
panel_builder.gd # Programmatic UI construction
panel_logger.gd # Formatted log output
scene_analyzer.gd # .tscn parser, extracts resource metadata
resource_collector.gd # Walks scene tree, collects resources
resource_exporter.gd # Saves resources as binary .res
export_scene_rewriter.gd # Rewrites .tscn for export
resource_importer.gd # Loads .res, serializes to .tres
tres_parser.gd # Parses .tres into sections
import_scene_rewriter.gd # Rewrites .tscn for import
import_file_utils.gd # Backup, cleanup, orphaned file deletion
Tests use the GUT framework. Test files are in test/unit/ and fixtures in test/fixtures/.
./run_tests.shTo use a custom Godot binary:
GODOT=/path/to/godot ./run_tests.shTo run a single test file:
godot --headless -s addons/gut/gut_cmdln.gd -gdir=res://test/unit/ -gprefix=test_ -gtest=test_scene_analyzer.gd -gexitMIT