extends Node3D # Auto-bakes the LightmapGI when opened in the Godot editor. # Only runs in editor mode — does nothing in exported builds. # # Manual bake: # Open the scene in the Godot editor, select LightmapGI node, # click "Bake Lightmap" in the inspector at the top of the node's properties. # # This script provides feedback in the editor Output panel. @tool func _ready(): if not Engine.is_editor_hint(): # Not in editor — nothing to do for runtime return # Check if we have a LightmapGI node var lightmap = _find_lightmap_gi() if not lightmap: push_error("KitDemo: No LightmapGI node found in scene!") return # Check if already baked if lightmap.light_data != null: print("KitDemo: Lightmap already baked. To re-bake:") print(" Select LightmapGI node → 'Bake Lightmap' button in Inspector") return # Not baked — offer to bake print("KitDemo: LightmapGI found but not baked.") print(" To bake: Select LightmapGI → click 'Bake Lightmap' at top of Inspector") print(" Or right-click LightmapGI node → 'Bake Lightmap'") print("") print(" LightmapGI settings:") print(" Bounces: ", lightmap.bounces) print(" Texel Scale: ", lightmap.texel_scale) print(" Texel Subdiv: ", lightmap.texel_subdiv) print(" Max Texture Size: ", lightmap.max_texture_size) print(" Interior: ", lightmap.interior) func _find_lightmap_gi() -> LightmapGI: for child in get_children(): if child is LightmapGI: return child return null