Changing a button's texturerect child no longer requires the theme in its file path

Instead, it automatically finds its path, adds the new file name and loads the new texture.
This commit is contained in:
OverloadedOrama 2020-05-06 15:19:53 +03:00
parent 9ce7bae2f9
commit 55e7178e1f
4 changed files with 28 additions and 43 deletions

View file

@ -714,6 +714,12 @@ func disable_button(button : BaseButton, disable : bool) -> void:
break
func change_button_texturerect(texture_button : TextureRect, new_file_name : String) -> void:
var file_name := texture_button.texture.resource_path.get_basename().get_file()
var directory_path := texture_button.texture.resource_path.get_basename().replace(file_name, "")
texture_button.texture = load(directory_path.plus_file(new_file_name))
func animation_tags_changed(value : Array) -> void:
animation_tags = value
for child in tag_container.get_children():