I enabled 2D backface culling glEnable(GL_CULL_FACE)
on the GLES3 reset_canvas method line in Godot 3.5 C++ source (https://github.com/godotengine/godot/blob/3.5/drivers/gles3/rasterizer_canvas_base_gles3.cpp#LL939C26-L939C26). GLES2 has an equivalent method also. The drawback is that it affects the editor GUI as well. I tried adding a working blackface culling option to the CanvasItem but I wasn't successful.
The editor popup windows' background texture disappear when you enable backface culling on canvas reset π
. This gdscript plugin patches the missing background textures by adding something in (hopefully).
tool
extends EditorPlugin
var background_texture = preload("res://solid_color.png")
func _enter_tree() -> void:
var base :Control = get_editor_interface().get_base_control()
var class_names_filter :Array = [
"EditorAbout",
"EditorExport",
"EditorFileDialog",
"EditorSettings",
"ExportTemplateManager",
"PluginConfigDialog",
"ProjectSettingsEditor",
"ProjectExportDialog",
"ScriptCreateDialog"
]
var result :Array = []
self.findByClass( base, class_names_filter, result )
for control in result:
self.add_TextureRect( control )
result = []
#For what ever reason, assigning show_behind_parent for Popup controls in the same loop
#as the rest of the other control classes make the other TextureRect nodes disappear.
self.findByClass( base, ["Popup"], result )
for control in result:
var t :TextureRect = self.add_TextureRect( control )
t.show_behind_parent = true
#t.self_modulate.a = .5
func findByClass(node :Node, class_names :Array, result :Array ) -> void:
for class_Name in class_names:
if node.is_class( class_Name ) :
result.push_back(node)
for child in node.get_children():
self.findByClass( child, class_names, result )
func add_TextureRect( control_node :Control ) -> TextureRect:
var base: Control = get_editor_interface().get_base_control()
var texture_rect := TextureRect.new()
texture_rect.texture = background_texture
texture_rect.expand = true
texture_rect.stretch_mode = TextureRect.STRETCH_TILE
texture_rect.modulate = Color.gray
connect("tree_exiting", texture_rect, "queue_free")
control_node.add_child( texture_rect )
self.match_rect(texture_rect, control_node)
control_node.move_child( texture_rect, 0 )
return texture_rect
func match_rect( of :Control, to :Control ) -> void:
of.rect_min_size = to.rect_min_size
of.rect_size = to.rect_size
of.rect_global_position = to.rect_global_position