-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ce060a
commit 0399088
Showing
46 changed files
with
57 additions
and
101 deletions.
There are no files selected for viewing
111 changes: 55 additions & 56 deletions
111
addons/animated_texture_but_better/animated_texture_but_better.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,57 @@ | ||
tool | ||
extends AnimatedTexture | ||
|
||
const ALLOWED_FILE_EXTENSIONS: PoolStringArray = PoolStringArray([ | ||
"png", "jpg", "jpeg", "gif", "tiff", "tif" | ||
]) | ||
|
||
export(String, DIR) var sprites_dir: String setget set_sprites_dir | ||
|
||
#func _init(): | ||
# set_sprites_dir_automatically() | ||
|
||
func set_sprites_dir(new_sprites_dir: String): | ||
sprites_dir = new_sprites_dir | ||
update_sprites() | ||
|
||
#func set_sprites_dir_automatically(): | ||
# var plugin = Engine.get_main_loop().find_node("AnimatedTextureButBetterPlugin", true, false) | ||
# if plugin: | ||
# sprites_dir = plugin.get_current_resource_directory() | ||
# update_sprites() | ||
|
||
func update_sprites(): | ||
frames = 1 | ||
|
||
if not sprites_dir: | ||
set_frame_texture(0, null) | ||
|
||
var dir: Directory = Directory.new() | ||
if dir.open(sprites_dir) == OK: | ||
dir.list_dir_begin() | ||
|
||
var file_name: String = dir.get_next() | ||
var texture_id: int = -1 | ||
while file_name: | ||
var name_extension_split: PoolStringArray = ( | ||
file_name.rsplit(".", true, 1) | ||
) | ||
|
||
if name_extension_split.size() >= 2 and name_extension_split[1] in ALLOWED_FILE_EXTENSIONS: | ||
var texture_id_split: Array = name_extension_split[0].rsplit("_", true, 1) | ||
|
||
if texture_id_split.size() >= 2 and texture_id_split[1].is_valid_integer(): | ||
texture_id = int(texture_id_split[1]) | ||
else: | ||
texture_id += 1 | ||
|
||
if texture_id + 1 > frames: | ||
frames = texture_id + 1 | ||
|
||
set_frame_texture( | ||
texture_id, | ||
load("%s/%s" % [sprites_dir, file_name]) | ||
) | ||
|
||
file_name = dir.get_next() | ||
|
||
dir.list_dir_end() | ||
#const ALLOWED_FILE_EXTENSIONS: PoolStringArray = PoolStringArray([ | ||
# "png", "jpg", "jpeg", "gif", "tiff", "tif" | ||
#]) | ||
# | ||
#export(String, DIR) var sprites_dir: String setget set_sprites_dir | ||
# | ||
##func _init(): | ||
## set_sprites_dir_automatically() | ||
# | ||
#func set_sprites_dir(new_sprites_dir: String): | ||
# sprites_dir = new_sprites_dir | ||
# update_sprites() | ||
# | ||
##func set_sprites_dir_automatically(): | ||
## var plugin = Engine.get_main_loop().find_node("AnimatedTextureButBetterPlugin", true, false) | ||
## if plugin: | ||
## sprites_dir = plugin.get_current_resource_directory() | ||
## update_sprites() | ||
# | ||
#func update_sprites(): | ||
# frames = 1 | ||
# | ||
# if not sprites_dir: | ||
# set_frame_texture(0, null) | ||
# | ||
# var dir: Directory = Directory.new() | ||
# if dir.open(sprites_dir) == OK: | ||
# dir.list_dir_begin() | ||
# | ||
# var file_name: String = dir.get_next() | ||
# var texture_id: int = -1 | ||
# while file_name: | ||
# var name_extension_split: PoolStringArray = ( | ||
# file_name.rsplit(".", true, 1) | ||
# ) | ||
# | ||
# if name_extension_split.size() >= 2 and name_extension_split[1] in ALLOWED_FILE_EXTENSIONS: | ||
# var texture_id_split: Array = name_extension_split[0].rsplit("_", true, 1) | ||
# | ||
# if texture_id_split.size() >= 2 and texture_id_split[1].is_valid_integer(): | ||
# texture_id = int(texture_id_split[1]) | ||
# else: | ||
# texture_id += 1 | ||
# | ||
# if texture_id + 1 > frames: | ||
# frames = texture_id + 1 | ||
# | ||
# set_frame_texture( | ||
# texture_id, | ||
# load("%s/%s" % [sprites_dir, file_name]) | ||
# ) | ||
# | ||
# file_name = dir.get_next() | ||
# | ||
# dir.list_dir_end() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters