-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get animations script to work with normal bootlegs
- Loading branch information
1 parent
159d4f1
commit b2a95c1
Showing
5 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from dataclasses import dataclass | ||
from typing import cast, IO, List | ||
|
||
import godot_parser as gp | ||
|
||
from .misc_types import Color | ||
|
||
|
||
@dataclass | ||
class ElementalType: | ||
palette: List[Color] | ||
|
||
@staticmethod | ||
def from_tres(input_stream: IO[str]) -> "ElementalType": | ||
scene = gp.parse(input_stream.read()) | ||
|
||
palette = None | ||
|
||
for section in scene.get_sections(): | ||
# pylint: disable-next=unidiomatic-typecheck | ||
if type(section) == gp.GDResourceSection: | ||
palette = section["palette"] | ||
|
||
assert isinstance(palette, list) | ||
|
||
for color in palette: | ||
assert isinstance(color, gp.Color) | ||
palette = cast(List[gp.Color], palette) | ||
|
||
return ElementalType(palette=[Color.from_gp(color) for color in palette]) |
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