mirror of
https://github.com/pmret/papermario.git
synced 2024-11-09 12:32:38 +01:00
Updates for Star Rod 0.4.x (#244)
* update SpriteSheet.xml reading * ignore star rod .backup files
This commit is contained in:
parent
986f594d00
commit
f2dfd435d9
1
.gitignore
vendored
1
.gitignore
vendored
@ -42,6 +42,7 @@ assets/
|
|||||||
/logs
|
/logs
|
||||||
/out
|
/out
|
||||||
dump
|
dump
|
||||||
|
*.backup
|
||||||
|
|
||||||
/tools/Yay0compress
|
/tools/Yay0compress
|
||||||
/tools/n64crc
|
/tools/n64crc
|
||||||
|
@ -138,8 +138,8 @@ class Sprite:
|
|||||||
SpriteSheet = xml.getroot()
|
SpriteSheet = xml.getroot()
|
||||||
|
|
||||||
true_max_components = 0
|
true_max_components = 0
|
||||||
self.max_components = int(SpriteSheet.get("a"))
|
self.max_components = int(SpriteSheet.get("a") or SpriteSheet.get("maxComponents")) # ignored
|
||||||
self.num_variations = int(SpriteSheet.get("b"))
|
self.num_variations = int(SpriteSheet.get("b") or SpriteSheet.get("paletteGroups"))
|
||||||
|
|
||||||
for Palette in SpriteSheet.findall("./PaletteList/Palette"):
|
for Palette in SpriteSheet.findall("./PaletteList/Palette"):
|
||||||
if read_images:
|
if read_images:
|
||||||
@ -147,11 +147,12 @@ class Sprite:
|
|||||||
img.preamble(True)
|
img.preamble(True)
|
||||||
palette = img.palette(alpha="force")
|
palette = img.palette(alpha="force")
|
||||||
|
|
||||||
|
palette = palette[0:16]
|
||||||
assert len(palette) == 16
|
assert len(palette) == 16
|
||||||
|
|
||||||
self.palettes.append(palette)
|
self.palettes.append(palette)
|
||||||
|
|
||||||
self.palette_names.append(Palette.get("src").split(".png")[0])
|
self.palette_names.append(Palette.get("name", Palette.get("src").split(".png")[0]))
|
||||||
|
|
||||||
for Raster in SpriteSheet.findall("./RasterList/Raster"):
|
for Raster in SpriteSheet.findall("./RasterList/Raster"):
|
||||||
if read_images:
|
if read_images:
|
||||||
@ -193,7 +194,8 @@ class Sprite:
|
|||||||
if len(components) > true_max_components:
|
if len(components) > true_max_components:
|
||||||
true_max_components = len(components)
|
true_max_components = len(components)
|
||||||
|
|
||||||
assert self.max_components == true_max_components, f"{true_max_components} component(s) used, but SpriteSheet.a = {self.max_components}"
|
self.max_components = true_max_components
|
||||||
|
#assert self.max_components == true_max_components, f"{true_max_components} component(s) used, but SpriteSheet.a = {self.max_components}"
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user