Initial Commit
Initial commit of Code Base.
This commit is contained in:
parent
293b1213e1
commit
c11a4ebbc2
653 changed files with 36893 additions and 1 deletions
44
addons/twitcher/media/magic_image_transformer.gd
Normal file
44
addons/twitcher/media/magic_image_transformer.gd
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
@icon("res://addons/twitcher/assets/media-loader-icon.svg")
|
||||
@tool
|
||||
extends TwitchImageTransformer
|
||||
|
||||
## A image transformer that uses a thirdparty program called ImageMagick
|
||||
## (https://imagemagick.org/script/download.php) to transform GIF's and similar files into
|
||||
## SpriteFrames. Battleproof very stable but uses an external program.
|
||||
class_name MagicImageTransformer
|
||||
|
||||
|
||||
## Path to the imagemagick program on windows its normally just 'magick' when it is available in the PATH
|
||||
@export_global_file var imagemagic_path: String:
|
||||
set = update_imagemagic_path
|
||||
|
||||
var supported: bool
|
||||
var converter: ImageMagickConverter
|
||||
|
||||
func is_supporting_animation() -> bool:
|
||||
return true
|
||||
|
||||
|
||||
func update_imagemagic_path(path: String) -> void:
|
||||
if imagemagic_path == path: return
|
||||
imagemagic_path = path
|
||||
if imagemagic_path != "":
|
||||
var out = []
|
||||
var err = OS.execute(imagemagic_path, ['-version'], out)
|
||||
if err == OK:
|
||||
converter = ImageMagickConverter.new()
|
||||
converter.fallback_texture = fallback_texture
|
||||
converter.imagemagic_path = imagemagic_path
|
||||
_log.i("Imagemagic detected: %s use it to transform gif/webm" % [ imagemagic_path ])
|
||||
supported = true
|
||||
return
|
||||
_log.i("Imagemagic at '%s' path was not detected or has a wrong result code: %s \n %s" % [ imagemagic_path, err, "\n".join(out) ])
|
||||
supported = false
|
||||
|
||||
|
||||
func is_supported() -> bool:
|
||||
return supported
|
||||
|
||||
|
||||
func convert_image(path: String, buffer_in: PackedByteArray, output_path: String) -> SpriteFrames:
|
||||
return await converter.dump_and_convert(path, buffer_in, output_path)
|
||||
Loading…
Add table
Add a link
Reference in a new issue