Open Qubus0 opened 9 months ago
I got the textured mask working during development by using create_from_image_alpha
and applying it to texture_click_mask
programmatically.
But I recently built the game for macOS, and this method is not working.
I can confirm this on 4.2.1.stable (Windows 11). After reassigning click masks:
[gd_scene load_steps=10 format=3 uid="uid://cj0v4wvgvtjnq"]
[ext_resource type="Texture2D" uid="uid://50kldrri6dqd" path="res://pressed/area_buttons2.png" id="2_v4wan"]
[ext_resource type="Texture2D" uid="uid://cb1wt77c7oq8y" path="res://area_buttons2.png" id="3_df6ig"]
[ext_resource type="BitMap" uid="uid://cb1wt77c7oq8y" path="res://buttons_masks/area_buttons2.png" id="3_uv2wv"]
[ext_resource type="Texture2D" uid="uid://bt05g5lnutn74" path="res://pressed/area_buttons3.png" id="4_di6t1"]
[ext_resource type="BitMap" uid="uid://ht8tfvhflfny" path="res://buttons_masks/area_buttons3.png" id="6_5uti1"]
[ext_resource type="Texture2D" uid="uid://ht8tfvhflfny" path="res://area_buttons3.png" id="6_8kgun"]
[ext_resource type="Texture2D" uid="uid://cj5lu61sda2sy" path="res://pressed/area_buttons4.png" id="6_ww5d3"]
[ext_resource type="BitMap" uid="uid://df8w7xa8sjbsp" path="res://buttons_masks/area_buttons4.png" id="9_qmqgr"]
[ext_resource type="Texture2D" uid="uid://df8w7xa8sjbsp" path="res://area_buttons4.png" id="9_y4mrd"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="TextureButton" type="TextureButton" parent="."]
layout_mode = 2
offset_right = 256.0
offset_bottom = 256.0
toggle_mode = true
texture_normal = ExtResource("3_df6ig")
texture_pressed = ExtResource("2_v4wan")
texture_click_mask = ExtResource("3_uv2wv")
[node name="TextureButton2" type="TextureButton" parent="."]
layout_mode = 2
offset_right = 256.0
offset_bottom = 256.0
toggle_mode = true
texture_normal = ExtResource("6_8kgun")
texture_pressed = ExtResource("4_di6t1")
texture_click_mask = ExtResource("6_5uti1")
[node name="TextureButton3" type="TextureButton" parent="."]
layout_mode = 2
offset_right = 256.0
offset_bottom = 256.0
toggle_mode = true
texture_normal = ExtResource("9_y4mrd")
texture_pressed = ExtResource("6_ww5d3")
texture_click_mask = ExtResource("9_qmqgr")
After saving the scene, reloading the scene and pressing Ctrl + S:
[gd_scene load_steps=7 format=3 uid="uid://cj0v4wvgvtjnq"]
[ext_resource type="Texture2D" uid="uid://50kldrri6dqd" path="res://pressed/area_buttons2.png" id="2_v4wan"]
[ext_resource type="Texture2D" uid="uid://cb1wt77c7oq8y" path="res://area_buttons2.png" id="3_uv2wv"]
[ext_resource type="Texture2D" uid="uid://bt05g5lnutn74" path="res://pressed/area_buttons3.png" id="4_di6t1"]
[ext_resource type="Texture2D" uid="uid://ht8tfvhflfny" path="res://area_buttons3.png" id="6_5uti1"]
[ext_resource type="Texture2D" uid="uid://cj5lu61sda2sy" path="res://pressed/area_buttons4.png" id="6_ww5d3"]
[ext_resource type="Texture2D" uid="uid://df8w7xa8sjbsp" path="res://area_buttons4.png" id="9_qmqgr"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="TextureButton" type="TextureButton" parent="."]
layout_mode = 2
offset_right = 256.0
offset_bottom = 256.0
toggle_mode = true
texture_normal = ExtResource("3_uv2wv")
texture_pressed = ExtResource("2_v4wan")
[node name="TextureButton2" type="TextureButton" parent="."]
layout_mode = 2
offset_right = 256.0
offset_bottom = 256.0
toggle_mode = true
texture_normal = ExtResource("6_5uti1")
texture_pressed = ExtResource("4_di6t1")
[node name="TextureButton3" type="TextureButton" parent="."]
layout_mode = 2
offset_right = 256.0
offset_bottom = 256.0
toggle_mode = true
texture_normal = ExtResource("9_qmqgr")
texture_pressed = ExtResource("6_ww5d3")
Some properties incorrectly have PROPERTY_HINT_RESOURCE_TYPE, "bool"
here, but removing these hints and recompiling doesn't resolve the issue: https://github.com/godotengine/godot/blob/87d40ba743ff3a3a484db051c11b16559604efa9/scene/gui/texture_button.cpp#L282-L285
Tested versions
System information
macOS 12.6.6
Issue description
Adding textures to a TextureButton with a click mask does not work - there are several things going wrong:
All of these are probably related, but they could also be independent. To me, it seems that something is wrong either with the BitMap, TextureButton, or the way that it is applied
Steps to reproduce
Minimal reproduction project (MRP)
ClickMaskMinimal.zip
note: click masks might not be applied, due to them being unset by on project open