Expose LightmapGI.bake to scripting.#116429
Conversation
439756b to
b8910af
Compare
b8910af to
a5f65cd
Compare
|
Tested, works mostly as expected in editor But nothing gets printed out of the callable: @tool
extends Button
class_name BakeLightmap
@export var lightmap: LightmapGI
@export_tool_button("Bake Lightmap", "LightmapGI")
var bake_lightmap_action = bake_lightmap
func _pressed() -> void:
bake_lightmap()
func bake_lightmap() -> void:
if lightmap:
lightmap.bake(owner, "", func(progress: float) -> bool:
print(progress)
return false
)Also doesn't work at runtime. At runtime I tried saving to |
Note that runtime baking will have the same constraints as #94965 (review), that is:
|
|
I had been following the previous PRs for runtime baking in exported projects and am still very much interested in this feature, thanks for bringing it up again. I'd like to use it in a game that features a map editor. @Calinou To my understanding, this PR has already been merged that enables tiny_exr in exports. I've tried to salvage the previously abandoned PR and merged it with this PR. The previous abandoned PR had working baking in export builds, but with all baked textures embedded as resources in the I've added new properties to bake.mp4Changeset: master...timklge:godot:runtime_bake_lightmap Built with EXR file + LightmapGIData resource are ~ 900 KB, embedded resource with the previous PR would have been ~ 6 MB for this tiny lightmap. Would this be a viable approach? I'm not experienced with the engine code, there's probably some way to link the external resources without the importer at runtime. |
Closes godotengine/godot-proposals#8656
I had to expose a wrapper function to convert
Callableto pair of (static bool()(...), void).Also provides the feature needed for a custom lightmap manager addon / script to implement godotengine/godot-proposals#10323 (which I think is best done as an addon due to being workflow specific).