I had a setup with nested CanvasLayer nodes. Toggling the visibility of the root CanvasLayer doesn’t hide any nested CanvasLayer nodes. My solution was to listen to the visibility_changed signal, find any CanvasLayer child nodes, and apply the same visibility to them.
func_ready() -> void:# If the visibility changes, apply it to any nested CanvasLayer nodes.visibility_changed.connect(func() -> void:find_children("*","CanvasLayer",true,false).map(func(node:CanvasLayer) -> void:node.visible=visible))
Development snapshot #4 of Godot Engine 4.1 is here. Among many other changes, it fixes a lighting issue related to using Light-only mode in CanvasItemMaterial (#44559). Unfortunately, it also introduced a UX issue with gradient color pickers (#77745), which makes it quite difficult to work with gradients at all. If you use gradients, I recommend …
This release improves weight management. Inventories can now configure an option weight limit, and item stacking and item transfer strategies are weight-aware. The crafting demo and crafting mechanic in the inventory tour have been improved. Auto-crafting is limited to the crafting slide, so that items don’t automatically and unexpectedly get crafted while stepping through the …
A little while ago, I created a type of AudioManager to make it easier to work with sound files in bulk: Rather than assigning audio streams by hand, I was doing it programmatically; reading the contents of a directory and using load() to get the resources. It worked great and saved a lot of time …
Any sufficiently large code base needs documentation. Documentation tends to come in all sorts of shapes and sizes. Among them are high-level architecture and design docs, class and method interface documentation, and inline comments to explain optimized or complex algorithms so the reader doesn’t have to parse the logic in their head (often, this is …
Toggling Visibility of Nested CanvasLayers
I had a setup with nested CanvasLayer nodes. Toggling the visibility of the root CanvasLayer doesn’t hide any nested CanvasLayer nodes. My solution was to listen to the visibility_changed signal, find any CanvasLayer child nodes, and apply the same visibility to them.
Related Posts
Godot Engine 4.1.dev4 is available
Development snapshot #4 of Godot Engine 4.1 is here. Among many other changes, it fixes a lighting issue related to using Light-only mode in CanvasItemMaterial (#44559). Unfortunately, it also introduced a UX issue with gradient color pickers (#77745), which makes it quite difficult to work with gradients at all. If you use gradients, I recommend …
Inventory System 2 Alpha 3 available
This release improves weight management. Inventories can now configure an option weight limit, and item stacking and item transfer strategies are weight-aware. The crafting demo and crafting mechanic in the inventory tour have been improved. Auto-crafting is limited to the crafting slide, so that items don’t automatically and unexpectedly get crafted while stepping through the …
Dynamically finding and loading resources from the Filesystem for Android and Web Exports
A little while ago, I created a type of AudioManager to make it easier to work with sound files in bulk: Rather than assigning audio streams by hand, I was doing it programmatically; reading the contents of a directory and using load() to get the resources. It worked great and saved a lot of time …
Generating documentation for GDScript
Any sufficiently large code base needs documentation. Documentation tends to come in all sorts of shapes and sizes. Among them are high-level architecture and design docs, class and method interface documentation, and inline comments to explain optimized or complex algorithms so the reader doesn’t have to parse the logic in their head (often, this is …