Merge pull request #68904 from aaronfranke/texture-methods

Rename TextureButton set_*_texture methods to set_texture_*
This commit is contained in:
Rémi Verschelde 2022-11-20 15:37:37 +01:00
commit 855402dfee
No known key found for this signature in database
GPG Key ID: C3336907360768E1
13 changed files with 84 additions and 84 deletions

View File

@ -27,19 +27,19 @@
<member name="texture_click_mask" type="BitMap" setter="set_click_mask" getter="get_click_mask"> <member name="texture_click_mask" type="BitMap" setter="set_click_mask" getter="get_click_mask">
Pure black and white [BitMap] image to use for click detection. On the mask, white pixels represent the button's clickable area. Use it to create buttons with curved shapes. Pure black and white [BitMap] image to use for click detection. On the mask, white pixels represent the button's clickable area. Use it to create buttons with curved shapes.
</member> </member>
<member name="texture_disabled" type="Texture2D" setter="set_disabled_texture" getter="get_disabled_texture"> <member name="texture_disabled" type="Texture2D" setter="set_texture_disabled" getter="get_texture_disabled">
Texture to display when the node is disabled. See [member BaseButton.disabled]. Texture to display when the node is disabled. See [member BaseButton.disabled].
</member> </member>
<member name="texture_focused" type="Texture2D" setter="set_focused_texture" getter="get_focused_texture"> <member name="texture_focused" type="Texture2D" setter="set_texture_focused" getter="get_texture_focused">
Texture to display when the node has mouse or keyboard focus. [member texture_focused] is displayed [i]over[/i] the base texture, so a partially transparent texture should be used to ensure the base texture remains visible. A texture that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a fully transparent texture of any size. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons. Texture to display when the node has mouse or keyboard focus. [member texture_focused] is displayed [i]over[/i] the base texture, so a partially transparent texture should be used to ensure the base texture remains visible. A texture that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a fully transparent texture of any size. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
</member> </member>
<member name="texture_hover" type="Texture2D" setter="set_hover_texture" getter="get_hover_texture"> <member name="texture_hover" type="Texture2D" setter="set_texture_hover" getter="get_texture_hover">
Texture to display when the mouse hovers the node. Texture to display when the mouse hovers the node.
</member> </member>
<member name="texture_normal" type="Texture2D" setter="set_normal_texture" getter="get_normal_texture"> <member name="texture_normal" type="Texture2D" setter="set_texture_normal" getter="get_texture_normal">
Texture to display by default, when the node is [b]not[/b] in the disabled, focused, hover or pressed state. Texture to display by default, when the node is [b]not[/b] in the disabled, focused, hover or pressed state.
</member> </member>
<member name="texture_pressed" type="Texture2D" setter="set_pressed_texture" getter="get_pressed_texture"> <member name="texture_pressed" type="Texture2D" setter="set_texture_pressed" getter="get_texture_pressed">
Texture to display on mouse down over the node, if the node has keyboard focus and the player presses the Enter key or if the player presses the [member BaseButton.shortcut] key. Texture to display on mouse down over the node, if the node has keyboard focus and the player presses the Enter key or if the player presses the [member BaseButton.shortcut] key.
</member> </member>
</members> </members>

View File

@ -91,10 +91,10 @@ void FindReplaceBar::_notification(int p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons"))); find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons")));
find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons"))); find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons")));
hide_button->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); hide_button->set_texture_normal(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_hover_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); hide_button->set_texture_hover(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_pressed_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); hide_button->set_texture_pressed(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size()); hide_button->set_custom_minimum_size(hide_button->get_texture_normal()->get_size());
} break; } break;
case NOTIFICATION_VISIBILITY_CHANGED: { case NOTIFICATION_VISIBILITY_CHANGED: {

View File

@ -2435,10 +2435,10 @@ void FindBar::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons"))); find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons")));
find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons"))); find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons")));
hide_button->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); hide_button->set_texture_normal(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_hover_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); hide_button->set_texture_hover(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_pressed_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); hide_button->set_texture_pressed(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size()); hide_button->set_custom_minimum_size(hide_button->get_texture_normal()->get_size());
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor"))); matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
} break; } break;

View File

@ -1169,9 +1169,9 @@ void EditorPropertyLayers::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_ENTER_TREE: case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
button->set_normal_texture(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); button->set_texture_normal(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
button->set_pressed_texture(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); button->set_texture_pressed(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
button->set_disabled_texture(get_theme_icon(SNAME("GuiTabMenu"), SNAME("EditorIcons"))); button->set_texture_disabled(get_theme_icon(SNAME("GuiTabMenu"), SNAME("EditorIcons")));
} break; } break;
} }
} }
@ -1811,8 +1811,8 @@ void EditorPropertyVector2::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_ENTER_TREE: case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
linked->set_normal_texture(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons"))); linked->set_texture_normal(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons")));
linked->set_pressed_texture(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons"))); linked->set_texture_pressed(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
const Color *colors = _get_property_colors(); const Color *colors = _get_property_colors();
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
@ -2089,8 +2089,8 @@ void EditorPropertyVector3::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_ENTER_TREE: case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
linked->set_normal_texture(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons"))); linked->set_texture_normal(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons")));
linked->set_pressed_texture(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons"))); linked->set_texture_pressed(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
const Color *colors = _get_property_colors(); const Color *colors = _get_property_colors();
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
@ -2224,8 +2224,8 @@ void EditorPropertyVector2i::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_ENTER_TREE: case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
linked->set_normal_texture(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons"))); linked->set_texture_normal(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons")));
linked->set_pressed_texture(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons"))); linked->set_texture_pressed(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
const Color *colors = _get_property_colors(); const Color *colors = _get_property_colors();
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
@ -2475,8 +2475,8 @@ void EditorPropertyVector3i::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_ENTER_TREE: case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
linked->set_normal_texture(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons"))); linked->set_texture_normal(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons")));
linked->set_pressed_texture(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons"))); linked->set_texture_pressed(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
const Color *colors = _get_property_colors(); const Color *colors = _get_property_colors();
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {

View File

@ -65,13 +65,13 @@ void EditorAssetLibraryItem::set_image(int p_type, int p_index, const Ref<Textur
ERR_FAIL_COND(p_type != EditorAssetLibrary::IMAGE_QUEUE_ICON); ERR_FAIL_COND(p_type != EditorAssetLibrary::IMAGE_QUEUE_ICON);
ERR_FAIL_COND(p_index != 0); ERR_FAIL_COND(p_index != 0);
icon->set_normal_texture(p_image); icon->set_texture_normal(p_image);
} }
void EditorAssetLibraryItem::_notification(int p_what) { void EditorAssetLibraryItem::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_ENTER_TREE: { case NOTIFICATION_ENTER_TREE: {
icon->set_normal_texture(get_theme_icon(SNAME("ProjectIconLoading"), SNAME("EditorIcons"))); icon->set_texture_normal(get_theme_icon(SNAME("ProjectIconLoading"), SNAME("EditorIcons")));
category->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5)); category->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5));
author->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5)); author->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5));
price->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5)); price->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5));
@ -402,7 +402,7 @@ void EditorAssetLibraryItemDownload::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("AssetLib"))); panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("AssetLib")));
status->add_theme_color_override("font_color", get_theme_color(SNAME("status_color"), SNAME("AssetLib"))); status->add_theme_color_override("font_color", get_theme_color(SNAME("status_color"), SNAME("AssetLib")));
dismiss_button->set_normal_texture(get_theme_icon(SNAME("dismiss"), SNAME("AssetLib"))); dismiss_button->set_texture_normal(get_theme_icon(SNAME("dismiss"), SNAME("AssetLib")));
} break; } break;
case NOTIFICATION_PROCESS: { case NOTIFICATION_PROCESS: {

View File

@ -38,9 +38,9 @@
void BoneMapperButton::fetch_textures() { void BoneMapperButton::fetch_textures() {
if (selected) { if (selected) {
set_normal_texture(get_theme_icon(SNAME("BoneMapperHandleSelected"), SNAME("EditorIcons"))); set_texture_normal(get_theme_icon(SNAME("BoneMapperHandleSelected"), SNAME("EditorIcons")));
} else { } else {
set_normal_texture(get_theme_icon(SNAME("BoneMapperHandle"), SNAME("EditorIcons"))); set_texture_normal(get_theme_icon(SNAME("BoneMapperHandle"), SNAME("EditorIcons")));
} }
set_offset(SIDE_LEFT, 0); set_offset(SIDE_LEFT, 0);
set_offset(SIDE_RIGHT, 0); set_offset(SIDE_RIGHT, 0);

View File

@ -72,15 +72,15 @@ void MaterialEditor::_update_theme_item_cache() {
void MaterialEditor::_notification(int p_what) { void MaterialEditor::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
light_1_switch->set_normal_texture(theme_cache.light_1_on); light_1_switch->set_texture_normal(theme_cache.light_1_on);
light_1_switch->set_pressed_texture(theme_cache.light_1_off); light_1_switch->set_texture_pressed(theme_cache.light_1_off);
light_2_switch->set_normal_texture(theme_cache.light_2_on); light_2_switch->set_texture_normal(theme_cache.light_2_on);
light_2_switch->set_pressed_texture(theme_cache.light_2_off); light_2_switch->set_texture_pressed(theme_cache.light_2_off);
sphere_switch->set_normal_texture(theme_cache.sphere_off); sphere_switch->set_texture_normal(theme_cache.sphere_off);
sphere_switch->set_pressed_texture(theme_cache.sphere_on); sphere_switch->set_texture_pressed(theme_cache.sphere_on);
box_switch->set_normal_texture(theme_cache.box_off); box_switch->set_texture_normal(theme_cache.box_off);
box_switch->set_pressed_texture(theme_cache.box_on); box_switch->set_texture_pressed(theme_cache.box_on);
} break; } break;
case NOTIFICATION_DRAW: { case NOTIFICATION_DRAW: {

View File

@ -61,10 +61,10 @@ void MeshEditor::_update_theme_item_cache() {
void MeshEditor::_notification(int p_what) { void MeshEditor::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
light_1_switch->set_normal_texture(theme_cache.light_1_on); light_1_switch->set_texture_normal(theme_cache.light_1_on);
light_1_switch->set_pressed_texture(theme_cache.light_1_off); light_1_switch->set_texture_pressed(theme_cache.light_1_off);
light_2_switch->set_normal_texture(theme_cache.light_2_on); light_2_switch->set_texture_normal(theme_cache.light_2_on);
light_2_switch->set_pressed_texture(theme_cache.light_2_off); light_2_switch->set_texture_pressed(theme_cache.light_2_off);
} break; } break;
} }
} }

View File

@ -80,9 +80,9 @@ void StyleBoxPreview::_notification(int p_what) {
// See https://github.com/godotengine/godot/issues/50743. // See https://github.com/godotengine/godot/issues/50743.
break; break;
} }
grid_preview->set_normal_texture(get_theme_icon(SNAME("StyleBoxGridInvisible"), SNAME("EditorIcons"))); grid_preview->set_texture_normal(get_theme_icon(SNAME("StyleBoxGridInvisible"), SNAME("EditorIcons")));
grid_preview->set_pressed_texture(get_theme_icon(SNAME("StyleBoxGridVisible"), SNAME("EditorIcons"))); grid_preview->set_texture_pressed(get_theme_icon(SNAME("StyleBoxGridVisible"), SNAME("EditorIcons")));
grid_preview->set_hover_texture(get_theme_icon(SNAME("StyleBoxGridVisible"), SNAME("EditorIcons"))); grid_preview->set_texture_hover(get_theme_icon(SNAME("StyleBoxGridVisible"), SNAME("EditorIcons")));
checkerboard->set_texture(get_theme_icon(SNAME("Checkerboard"), SNAME("EditorIcons"))); checkerboard->set_texture(get_theme_icon(SNAME("Checkerboard"), SNAME("EditorIcons")));
} break; } break;
} }

View File

@ -816,8 +816,8 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
if (vsnode->is_output_port_expandable(i)) { if (vsnode->is_output_port_expandable(i)) {
TextureButton *expand = memnew(TextureButton); TextureButton *expand = memnew(TextureButton);
expand->set_toggle_mode(true); expand->set_toggle_mode(true);
expand->set_normal_texture(editor->get_theme_icon(SNAME("GuiTreeArrowDown"), SNAME("EditorIcons"))); expand->set_texture_normal(editor->get_theme_icon(SNAME("GuiTreeArrowDown"), SNAME("EditorIcons")));
expand->set_pressed_texture(editor->get_theme_icon(SNAME("GuiTreeArrowRight"), SNAME("EditorIcons"))); expand->set_texture_pressed(editor->get_theme_icon(SNAME("GuiTreeArrowRight"), SNAME("EditorIcons")));
expand->set_v_size_flags(Control::SIZE_SHRINK_CENTER); expand->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
expand->set_pressed(vsnode->_is_output_port_expanded(i)); expand->set_pressed(vsnode->_is_output_port_expanded(i));
expand->connect("pressed", callable_mp(editor, &VisualShaderEditor::_expand_output_port).bind(p_id, i, !vsnode->_is_output_port_expanded(i)), CONNECT_DEFERRED); expand->connect("pressed", callable_mp(editor, &VisualShaderEditor::_expand_output_port).bind(p_id, i, !vsnode->_is_output_port_expanded(i)), CONNECT_DEFERRED);
@ -826,8 +826,8 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
if (vsnode->has_output_port_preview(i) && port_right != VisualShaderNode::PORT_TYPE_TRANSFORM && port_right != VisualShaderNode::PORT_TYPE_SAMPLER) { if (vsnode->has_output_port_preview(i) && port_right != VisualShaderNode::PORT_TYPE_TRANSFORM && port_right != VisualShaderNode::PORT_TYPE_SAMPLER) {
TextureButton *preview = memnew(TextureButton); TextureButton *preview = memnew(TextureButton);
preview->set_toggle_mode(true); preview->set_toggle_mode(true);
preview->set_normal_texture(editor->get_theme_icon(SNAME("GuiVisibilityHidden"), SNAME("EditorIcons"))); preview->set_texture_normal(editor->get_theme_icon(SNAME("GuiVisibilityHidden"), SNAME("EditorIcons")));
preview->set_pressed_texture(editor->get_theme_icon(SNAME("GuiVisibilityVisible"), SNAME("EditorIcons"))); preview->set_texture_pressed(editor->get_theme_icon(SNAME("GuiVisibilityVisible"), SNAME("EditorIcons")));
preview->set_v_size_flags(Control::SIZE_SHRINK_CENTER); preview->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
register_output_port(p_id, j, preview); register_output_port(p_id, j, preview);

View File

@ -1376,7 +1376,7 @@ void ProjectList::create_project_item_control(int p_index) {
favorite_box->set_name("FavoriteBox"); favorite_box->set_name("FavoriteBox");
TextureButton *favorite = memnew(TextureButton); TextureButton *favorite = memnew(TextureButton);
favorite->set_name("FavoriteButton"); favorite->set_name("FavoriteButton");
favorite->set_normal_texture(favorite_icon); favorite->set_texture_normal(favorite_icon);
// This makes the project's "hover" style display correctly when hovering the favorite icon. // This makes the project's "hover" style display correctly when hovering the favorite icon.
favorite->set_mouse_filter(MOUSE_FILTER_PASS); favorite->set_mouse_filter(MOUSE_FILTER_PASS);
favorite->connect("pressed", callable_mp(this, &ProjectList::_favorite_pressed).bind(hb)); favorite->connect("pressed", callable_mp(this, &ProjectList::_favorite_pressed).bind(hb));

View File

@ -250,11 +250,11 @@ void TextureButton::_notification(int p_what) {
} }
void TextureButton::_bind_methods() { void TextureButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_normal_texture", "texture"), &TextureButton::set_normal_texture); ClassDB::bind_method(D_METHOD("set_texture_normal", "texture"), &TextureButton::set_texture_normal);
ClassDB::bind_method(D_METHOD("set_pressed_texture", "texture"), &TextureButton::set_pressed_texture); ClassDB::bind_method(D_METHOD("set_texture_pressed", "texture"), &TextureButton::set_texture_pressed);
ClassDB::bind_method(D_METHOD("set_hover_texture", "texture"), &TextureButton::set_hover_texture); ClassDB::bind_method(D_METHOD("set_texture_hover", "texture"), &TextureButton::set_texture_hover);
ClassDB::bind_method(D_METHOD("set_disabled_texture", "texture"), &TextureButton::set_disabled_texture); ClassDB::bind_method(D_METHOD("set_texture_disabled", "texture"), &TextureButton::set_texture_disabled);
ClassDB::bind_method(D_METHOD("set_focused_texture", "texture"), &TextureButton::set_focused_texture); ClassDB::bind_method(D_METHOD("set_texture_focused", "texture"), &TextureButton::set_texture_focused);
ClassDB::bind_method(D_METHOD("set_click_mask", "mask"), &TextureButton::set_click_mask); ClassDB::bind_method(D_METHOD("set_click_mask", "mask"), &TextureButton::set_click_mask);
ClassDB::bind_method(D_METHOD("set_ignore_texture_size", "ignore"), &TextureButton::set_ignore_texture_size); ClassDB::bind_method(D_METHOD("set_ignore_texture_size", "ignore"), &TextureButton::set_ignore_texture_size);
ClassDB::bind_method(D_METHOD("set_stretch_mode", "mode"), &TextureButton::set_stretch_mode); ClassDB::bind_method(D_METHOD("set_stretch_mode", "mode"), &TextureButton::set_stretch_mode);
@ -263,21 +263,21 @@ void TextureButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_flip_v", "enable"), &TextureButton::set_flip_v); ClassDB::bind_method(D_METHOD("set_flip_v", "enable"), &TextureButton::set_flip_v);
ClassDB::bind_method(D_METHOD("is_flipped_v"), &TextureButton::is_flipped_v); ClassDB::bind_method(D_METHOD("is_flipped_v"), &TextureButton::is_flipped_v);
ClassDB::bind_method(D_METHOD("get_normal_texture"), &TextureButton::get_normal_texture); ClassDB::bind_method(D_METHOD("get_texture_normal"), &TextureButton::get_texture_normal);
ClassDB::bind_method(D_METHOD("get_pressed_texture"), &TextureButton::get_pressed_texture); ClassDB::bind_method(D_METHOD("get_texture_pressed"), &TextureButton::get_texture_pressed);
ClassDB::bind_method(D_METHOD("get_hover_texture"), &TextureButton::get_hover_texture); ClassDB::bind_method(D_METHOD("get_texture_hover"), &TextureButton::get_texture_hover);
ClassDB::bind_method(D_METHOD("get_disabled_texture"), &TextureButton::get_disabled_texture); ClassDB::bind_method(D_METHOD("get_texture_disabled"), &TextureButton::get_texture_disabled);
ClassDB::bind_method(D_METHOD("get_focused_texture"), &TextureButton::get_focused_texture); ClassDB::bind_method(D_METHOD("get_texture_focused"), &TextureButton::get_texture_focused);
ClassDB::bind_method(D_METHOD("get_click_mask"), &TextureButton::get_click_mask); ClassDB::bind_method(D_METHOD("get_click_mask"), &TextureButton::get_click_mask);
ClassDB::bind_method(D_METHOD("get_ignore_texture_size"), &TextureButton::get_ignore_texture_size); ClassDB::bind_method(D_METHOD("get_ignore_texture_size"), &TextureButton::get_ignore_texture_size);
ClassDB::bind_method(D_METHOD("get_stretch_mode"), &TextureButton::get_stretch_mode); ClassDB::bind_method(D_METHOD("get_stretch_mode"), &TextureButton::get_stretch_mode);
ADD_GROUP("Textures", "texture_"); ADD_GROUP("Textures", "texture_");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_normal", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_normal_texture", "get_normal_texture"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_normal", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture_normal", "get_texture_normal");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_pressed", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_pressed_texture", "get_pressed_texture"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_pressed", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture_pressed", "get_texture_pressed");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_hover", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_hover_texture", "get_hover_texture"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_hover", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture_hover", "get_texture_hover");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_disabled", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_disabled_texture", "get_disabled_texture"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_disabled", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture_disabled", "get_texture_disabled");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_focused", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_focused_texture", "get_focused_texture"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_focused", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture_focused", "get_texture_focused");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_click_mask", PROPERTY_HINT_RESOURCE_TYPE, "BitMap"), "set_click_mask", "get_click_mask"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_click_mask", PROPERTY_HINT_RESOURCE_TYPE, "BitMap"), "set_click_mask", "get_click_mask");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ignore_texture_size", PROPERTY_HINT_RESOURCE_TYPE, "bool"), "set_ignore_texture_size", "get_ignore_texture_size"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ignore_texture_size", PROPERTY_HINT_RESOURCE_TYPE, "bool"), "set_ignore_texture_size", "get_ignore_texture_size");
ADD_PROPERTY(PropertyInfo(Variant::INT, "stretch_mode", PROPERTY_HINT_ENUM, "Scale,Tile,Keep,Keep Centered,Keep Aspect,Keep Aspect Centered,Keep Aspect Covered"), "set_stretch_mode", "get_stretch_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "stretch_mode", PROPERTY_HINT_ENUM, "Scale,Tile,Keep,Keep Centered,Keep Aspect,Keep Aspect Centered,Keep Aspect Covered"), "set_stretch_mode", "get_stretch_mode");
@ -293,7 +293,7 @@ void TextureButton::_bind_methods() {
BIND_ENUM_CONSTANT(STRETCH_KEEP_ASPECT_COVERED); BIND_ENUM_CONSTANT(STRETCH_KEEP_ASPECT_COVERED);
} }
void TextureButton::set_normal_texture(const Ref<Texture2D> &p_normal) { void TextureButton::set_texture_normal(const Ref<Texture2D> &p_normal) {
if (normal == p_normal) { if (normal == p_normal) {
return; return;
} }
@ -303,7 +303,7 @@ void TextureButton::set_normal_texture(const Ref<Texture2D> &p_normal) {
update_minimum_size(); update_minimum_size();
} }
void TextureButton::set_pressed_texture(const Ref<Texture2D> &p_pressed) { void TextureButton::set_texture_pressed(const Ref<Texture2D> &p_pressed) {
if (pressed == p_pressed) { if (pressed == p_pressed) {
return; return;
} }
@ -313,7 +313,7 @@ void TextureButton::set_pressed_texture(const Ref<Texture2D> &p_pressed) {
update_minimum_size(); update_minimum_size();
} }
void TextureButton::set_hover_texture(const Ref<Texture2D> &p_hover) { void TextureButton::set_texture_hover(const Ref<Texture2D> &p_hover) {
if (hover == p_hover) { if (hover == p_hover) {
return; return;
} }
@ -323,7 +323,7 @@ void TextureButton::set_hover_texture(const Ref<Texture2D> &p_hover) {
update_minimum_size(); update_minimum_size();
} }
void TextureButton::set_disabled_texture(const Ref<Texture2D> &p_disabled) { void TextureButton::set_texture_disabled(const Ref<Texture2D> &p_disabled) {
if (disabled == p_disabled) { if (disabled == p_disabled) {
return; return;
} }
@ -341,19 +341,19 @@ void TextureButton::set_click_mask(const Ref<BitMap> &p_click_mask) {
update_minimum_size(); update_minimum_size();
} }
Ref<Texture2D> TextureButton::get_normal_texture() const { Ref<Texture2D> TextureButton::get_texture_normal() const {
return normal; return normal;
} }
Ref<Texture2D> TextureButton::get_pressed_texture() const { Ref<Texture2D> TextureButton::get_texture_pressed() const {
return pressed; return pressed;
} }
Ref<Texture2D> TextureButton::get_hover_texture() const { Ref<Texture2D> TextureButton::get_texture_hover() const {
return hover; return hover;
} }
Ref<Texture2D> TextureButton::get_disabled_texture() const { Ref<Texture2D> TextureButton::get_texture_disabled() const {
return disabled; return disabled;
} }
@ -361,11 +361,11 @@ Ref<BitMap> TextureButton::get_click_mask() const {
return click_mask; return click_mask;
} }
Ref<Texture2D> TextureButton::get_focused_texture() const { Ref<Texture2D> TextureButton::get_texture_focused() const {
return focused; return focused;
}; };
void TextureButton::set_focused_texture(const Ref<Texture2D> &p_focused) { void TextureButton::set_texture_focused(const Ref<Texture2D> &p_focused) {
focused = p_focused; focused = p_focused;
}; };

View File

@ -71,18 +71,18 @@ protected:
static void _bind_methods(); static void _bind_methods();
public: public:
void set_normal_texture(const Ref<Texture2D> &p_normal); void set_texture_normal(const Ref<Texture2D> &p_normal);
void set_pressed_texture(const Ref<Texture2D> &p_pressed); void set_texture_pressed(const Ref<Texture2D> &p_pressed);
void set_hover_texture(const Ref<Texture2D> &p_hover); void set_texture_hover(const Ref<Texture2D> &p_hover);
void set_disabled_texture(const Ref<Texture2D> &p_disabled); void set_texture_disabled(const Ref<Texture2D> &p_disabled);
void set_focused_texture(const Ref<Texture2D> &p_focused); void set_texture_focused(const Ref<Texture2D> &p_focused);
void set_click_mask(const Ref<BitMap> &p_click_mask); void set_click_mask(const Ref<BitMap> &p_click_mask);
Ref<Texture2D> get_normal_texture() const; Ref<Texture2D> get_texture_normal() const;
Ref<Texture2D> get_pressed_texture() const; Ref<Texture2D> get_texture_pressed() const;
Ref<Texture2D> get_hover_texture() const; Ref<Texture2D> get_texture_hover() const;
Ref<Texture2D> get_disabled_texture() const; Ref<Texture2D> get_texture_disabled() const;
Ref<Texture2D> get_focused_texture() const; Ref<Texture2D> get_texture_focused() const;
Ref<BitMap> get_click_mask() const; Ref<BitMap> get_click_mask() const;
bool get_ignore_texture_size() const; bool get_ignore_texture_size() const;